Support flattened shapes.

Fixes #25.