add takeSnapshot fuction