added some code to store snapshots...still testing it