Recursion problem solved