Collections WIP

#386 is going to take a while, so I've created the `collections` branch to work in. This is the first pull request against that branch. It's not ready to be merged yet, but I figured I'd put it up here so progress is easy to watch.

Apologies for the whitespace noise.