simplification of sensor code