refactored registration