refactored registration process