Terrain refactoring