refactor the svg generation code.