chaning factorial calculations to utilize a look up table instead of calculating it on the fly