Change code to remove obsolete statistics to more stable code with less iterations. Thanks to ammdispose for the patch.