added the snapshot function, needs to be tested