Clean up hoisting out the sensor code.