slight refactor of filterContent method