Added accelerometer function