Remove duplication and magic numbers from terrain.