Refactoring register user error