Factory refactoring