Refactor and further work on flights module