WIP: implementing query filtering