Added an export stats function