Refactoring of factories