modified contextify with snapshotting feature