Code for registering.