ErrorChecking and CalculateAverage functions completed