cleanup and document. Closes #28