Changing sum to avg