keeping the document html semantically correct