Custom filter refactor