refactored code so that we send a single request instead of query queue.