Fix broken space theme

Problem was due to xml:base interfering with same-document references
Tidy up main.js