working on factorial function