added function definitions in reverse-mode example