added reset_queries to reduce memory use