refactoring device/emulator code into Devices