refactoring for register view