added autopilot code