cleans up code with lint.
adds sumForEach and averageForEach