refactoring the registration pieces