I think it is better to inline the function within the filter function