Refactored device to remove .map/.when and moved it to device_config