implemented CostQuery