added query caching