Declaring variables properly
Fixing svg variable

I forgot I can't assign svg immediately because I can't trust it to be
loaded yet.  Leaving that to be done by each function as it needs it
works well enough for now.