Refactor Map class.

Change-Id: I55cb86f795e8f46fb86107429e922ecd7b6e4a96