recursion and some refactoring
recursion with let rec