Added back the highlight filtering, refactored it, and added documentation in a comment.