updated snapshot function