clean up query routing