Made thread safe, Added option for expanding moving average window, improved documentation, added tests