added code to render the grid in the UI