snapshot refactored and tested