query_id handled by all response handlers

Made sure that all the receivePrefixList-handlers verifies that the
query_id is not lower than the latest received query's. Also refactored
the code a bit to reduce code duplication.

Fixes #391