Some changes in average.py