minor modifications. Seems I'll have to abandon IntervalTree