Rewriting how ranges are put into tree map