refactoring stats class