Add _RenderFigure function to remove duplicate code