Added total cost calculation.