Exports and cleanup.
Test and cleanup.
Merge branch `rewrite` into `master`.