Refactor reportState into an object that is passed instead of a global variable

This allows multiple grids on the same page