Updated device.c