updated code for device.platform