changed snapshot code