Clean up some code-review issues
Hoist WriteMsg calls up
Extract checkInFlightQueries method
Simplified algorithm in checkInFlightQueries()