Add testing. Modify Device.js for correct errors (found with testing) and matching the test.