Change the filter to be a function