changes in the recursive function