Map interface refactoring update

@arthurbenemann, I updated the branch to be compatible with the latest from upstream/master.
I had to do a 'git revert' to undo the delete operation you did when you remove the previous pull request. Could you double check this doesn't undo some of the recent merges.

I already took a look, and everything looks fine, but a second pair of eyes is welcomed.