Reapplied Jimx's terrain.py changes after ronmurphy's merge
Source of changes: b6419df13b13ff8c4b3c97aa7b5e7b6923e2e42b
Source of deletion: 1430eb58d0ce030ecf25c114ad9a4bfcb30db377
Re: #64