Changed map to unordered_map. Map uses a RB Tree, while unordered_map is an actual HashMap with O(1) retrieval.