Added proper crash detection and cave height

Cave height will converge towards a minimum, instead of decreasing linearly