Map changes

This is a rather massive rewrite of the map code
I think the result is awesome and makes the map MUCH more useful, but given how much I changed in the logic I'm a bit nervous. This might have some bugs hiding somewhere (but that shouldn't distract from the fact that the code that was in place before was riddled with issues - so I'm certain that this is a massive improvement).