Sensor code improvement

+code cleanup