Refactorng factory