Added drawing of the grid and legend