User factory refactoring.