flight app refactoring