Reimplement custom filter function - WIP