Documentation and cleanup.
Reorganized code structure and optimized terrain code.