upgraded for USB tethering and Sensor orientation