Refactor registration validation