Working on Cave logic