ReadQuery Function updated