Replace ArrayList with HashMap for storage.