most of query working