Cleaned up the factory and removed unnecessary listener function