Add flight counting
Refactor some tasks