refactoring register process