Working Version. Heavily modified Averaging system