recursion to rescue