Fix up the javascript and HTML generation, to try and bring it up to standards.