this this should live outside and you should pass in the filter function.