query running function added