Refactor export_toSVG