Sensor refactor and fixes