Made PATTERN highlighting a bit more robust