adding the new code for reading snapshots.