Allow filter to accept a string or a filter function