Refactoring, adding autopilot support