Reorganization of flight code