Changed registerdevice query
Trying to decrypt data
Removed bugs, encyption in place