WIP: One way to do document export
WIP: more unrelated changes