Extracted apply_filter()