added snapshot function