Refactor and DRY out registration

This makes it easier to extend registration without having to duplicate
all of the code again
Merge pull request #759 from ahinz/topic/updates-to-reg

Topic/updates to reg