updated accelerometer code