There is a lot of redundant specification of newHTMLDocument(). Maybe that indicates the flexibility isn't needed here?