modernized k-nn statistics.