Update the query object and add tests.