client handles query handling