added function to create snapshot