added case to filter by queries