Added recursion code