Completed statistics feature; refactoring for DRY