move method getFactorial into single class