Rewritten cave generation