Factory refactor