Added stats calculation and printing.