added recursion version as suggested, eta reduction