Further work on Terrain integration. Working fine now.