Added some functionality for statistic tracking.