Insert JavaScript code into the SVG document
Code cleanup
Recycle color palette used for highlighting
Minor code rearrangement