improved generics for the filter operator