refactored registering