improve contains() for ranges