Removing validate function from factorial, adding it to a helper file that can be used to as many as algorithms as possible.