adds back in the old version of the recursive function.