writing the document in a modular fashion