Changed highlight function

Highlight works in order of length decreasing.