Add a bunch of query tests, update some docs