added recursion limit, removed debug line