Sensor refactor working