improve contains_interval()