Handlers for queries.