Optimizes hightlight function