Added document data writing