Devices version of motor.js

Includes tests.