statistical function re-factoring started