Added accelerometer control from existing code