collapsing empty ranges