Snapshots

As discussed in #18, here's some WIP to support snapshots.