wrote factorial function and specs