Updated cleanup/builder pattern.

Supersedes and closes #4. (I can't push to that PR.)