modefied index.js --> now trying to register the device