Statistics management refactored and improved.