removed unnecessary assignment that lead to duplicate nodes
extracted svg construction to template