Half-done refactor of query class. Checking gtest anomaly on linux.