Added a stats function