Changes to meanValueArray. Not tested.