Significantly improved ore generation code