Finished the recursion part