Code to build model grid.