fix bug: return from calulateAverage; testing functions