change factorial to object