move some highlighting logic