Changed terrain object to dictionary.

The terrain object is a Dictionary now, so it allows looping through its elements.