Added total cost calculation