Separate the SVG-generating logic.