Fixes to html5 and preamble.js in line with feedback from ChrisM. Minor tidy changes to other files