Use batch stats calls, and fix most of the style issues