Changed to average of last n values by += and dividing by the count.