added snapshot saving