Added snapshot code