Improved overlaps matching (it now considers protocols too).