Implement statistics tracking.