simplifiy some code
make Register strongly typed