Some stats updates and better logging