Got rid of squaring of averageFrequency