Refactor to use LinkedHashMap.