Major rewrite.

Separated out SVG methods from the core engine.