changed operator resolution by adding getCost method