recursion loops eliminated