using interval trees to get spanned intervals