reading in queries