move snapshot functions to snapshot.go