Refactored most of the grid