Stats refactoring