Refactored statistics module