Added support for square grids