Implement a flattener utility.

Closes #28