fix for #19

This fixes issue #19 and optimizes the highlighting check method.