working through the recursion