Started work on query handling