Move grids code to objects