Rewrite TreeMap