Refactoring regarding user factory implementation