refactor SVG creation code to use API in core