add snapshot in functions