Refactored the stats tracker