add support for snapshots, with tests