refactor ObjectFactory