added functioning preview

Preview displays the grid correctly.