Statistics refactoring