changed interface of query and query_value to const&