added reverse recursion function