code cleanup, added for loop to calculate average
Please enter the commit message for your changes. Lines starting