add calculateFactorial code