I still don't see the reason why it has to be a separate function. Make it an inline function for filter() please which let us better follow the flow.