Refactored code.

Removed Multimap logic as it was redundant.