Changed HashMap to TreeMap