Re-organized CalculateMean code
Refactored CalculateMean