Fix brutal memory leak

Add running average module

Add state logging channel