Redid the Factory

Redid the factory so it was more in line with the way other
factories are impmemented. Also added test cases for it.