Refactored link filtering