Refactor getSnapshot