Tons of cleanup, especially in 'gen/cave.rs'.