add cost calculation