Replaced HashMap with the more general Map.