Fixed the factory method