manages queries