Compatibility fixes

Code now mostly validates for xhtml 1.0 strict (only error is the
doctype is for html5)