refactor registration a little