Get rid of recursion