refactor registration method