Removed parseDocument() from beginning of flush; the idea is to keep
document structure in memory from parsing step.