added only min filter and added splitting to subqueries