Added snapshot function