Registration

Implementation of the registration functionality.

Lots of setup as well.