Refactored the sensorEventHandler into two classes