Remove dead code.
Use pre-tree flush in stages.

Closes #151.
Test reopening and merging previous stages.

Closes #152.
Use `assert` in tests.

Closes #153.