Cleaned up terrain mesh building code from previous commit