Second implementation, recursion, pass by value