flight refactor