refactored type filter