Terrain loading done.
Lots of cleanups and refactoring