average calculation updated