diff: refactor highlightBlock() into separate functions