refactoring DeviceHandler