Added functions to the factory. Cleaned it up