Some minor changes to CalculateMean