cosmetic changes to base/statistics.jl (prepare for further refactoring)

Nothing was really changed here. The file was reorganized a bit, so it makes it easier to read & maintain (e.g. future updating).