Refactoring Map class