Refactoring validations and implementing user registration