Code and architecture redesign

From unordered_map to unordered_multiset for insertion and deletion
efficiency