solution to recfun