refactor registration