added recursion funtions