Rewritten TreeMap passes most of tests