Adding recursion forward and backward