move device creation to device.js