adding statistics and printing functions.