added calculation of average values