added support for subqueries in the filter