Added refined check for equal endpoints of ranges
Added check for backwards interval