Refactor to remove multiple hashmaps.