Added code to save sensor data