Dealing with tail recursion.