Refactored for readability.
Bug fix: allow highlighting to be disabled (default now = off).