work on query protocol