Changes for cost of sale function