Fix recursion step, add tests