User registration refactoring