Separate SVG module
Tidied up diagram creation and update