[skip ci] work in progress centralising the filtering logic