Move snapshot helpers to new file snap.[ch].