First pass at WRITE-DOCUMENT, document exported protocol helpers.