Minor refactoring in register()