Refactored code in SnapshotStore callback function