Major parts of the highlighting code were taken from hl-line-mode.el.