Refactoring in stats