major refactor for the grid