Refactor to use a hashtable for readability.