Implemented custom layout of the grid.