Hacked together fixes for html generation to be more userfriendly and accurate

--HG--
extra : amend_source : db8db157b4e5279da5c29b008b80226d50713f50