Abstraction to perform a running average.