Added optimized single threaded factorial