First implementation, recursion, pass by reference