Using hash map again, now very simplified.