Added stat logging function. Made it log every 50 packets processed. Fixed stats updating