grid: Initial version of grid, which contains pure logic.