do {
    // let's go with the current query
    $outPrefix = 'Q: ' . $workingQuery . ': ';
    echo $outPrefix . "started\n";
    $someQueries = [$workingQuery];
    // search youtube for N queries, for M (3) ordering criteria
    /* @var $videoLeads YTVideo[] */
    $videoLeads = [];
    foreach ($someQueries as $query) {
        foreach (QUERY_SORTING_SEQUENCE as $order) {
            // search for the current Query, using each of the 4 criteria...
            $criteria = new YTSearchCriteria(trim($query), QUERY_HD_ONLY);
            $criteria->setOrder($order);
            $videos = $ytMachine->searchVideos($criteria, QUERY_RESULTS_COUNT);
            // ...and merge into 1 list
            $ytMachine->mergeUniqueVideos($videoLeads, $videos);
        }
    }
    echo $outPrefix . sizeof($videoLeads) . " videos merged from " . sizeof(QUERY_SORTING_SEQUENCE) . " searches\n";
    echo $outPrefix . 'fetching and indexing [';
    // process each video: get caption, get details, send to index
    /* @var $videoLeads YTVideo[] */
    $newVideos = [];
    $n = 1;
    shuffle($videoLeads);
    foreach ($videoLeads as $video) {
        // OPTIMIZATION: skip resolving if we already did it in the past and
        // the video has already been indexed (or we know it can't be).
        if (!FORCE_REINDEX && CacheMachine::setContains(VIDEOS_PROCESSED_SET, $video->videoId)) {
            echo ' ';
            continue;