Made the grid creation code block into a named function: createGrid()