Fixing the factory and adding tests.