Stored the stats and created function that calculates trace