refactoring of registration