Register

Implemented the register function.