create functioning factorial script