Remove legacy code from document-write module