Conversion to using Hashmap