refactor filterContent method