Replace filter func. with more idiomatic version

@robyoung
@pbadenski