replaced TreeMap with HashMap