completed recursion