Cleaned up some of the sensor functions.