rewrote autopilot code to support tablet