added a ``removeWhenEmpty`` field to the filters which allows a lot of special case code to be removed.