Fixed tail recursion definition