Factor out snapshotting