Added code for device registration.