for ($counter = 0; $counter < $totalNumObjects; $counter++) {
    // grab the next object from the result set
    $theObject = $allPDFObjects[$counter];
    // increment the counter shown to the user
    $realCount = $counter + 1;
    drush_print("Processing record {$realCount} of {$totalNumObjects}");
    // grab the PID value from the object array
    $objectPID = $theObject['s']['value'];
    # try to fetch PID from repo
    try {
        $object = $repository->getObject($objectPID);
    } catch (Exception $e) {
        drush_print("\n\n**********#######  ERROR  #######*********");
        drush_print("***Could not get object {$objectPID} from repo***\n\n");
        continue;
    }
    // forces generation/regeneration of FITS data
    $forceGeneration = TRUE;
    // the magic call?
    $result = islandora_fits_create_techmd($object, $forceGeneration, array('source_dsid' => 'OBJ', 'destination_dsid' => 'TECHMD', 'weight' => '0', 'function' => array('islandora_fits_create_techmd'), 'file' => drupal_get_path('module', 'islandora_fits') . '/includes/derivatives.inc'));
    // check to make sure the result was successful as reported by the function
    if ($result['success'] == 1) {
        $objectsChanged++;
    } else {
        print "\n\n**ERROR generating FITS data for {$objectPID}\n";
        print_r($result);
    }
}
drush_print("Main processing loop complete");
drush_print("{$objectsChanged} out of {$totalNumObjects} objects were updated");
echo "\n\nAll operations complete\n";
 # try to fetch PID from repo
 try {
     $object = $repository->getObject($objectPID);
 } catch (Exception $e) {
     drush_print("\n\n**********#######  ERROR  #######*********");
     drush_print("***Could not get object {$objectPID} from repo***\n\n");
     $skippedObjects[] = $objectPID;
     continue;
 }
 // forces generation/regeneration of FITS data
 $forceGeneration = TRUE;
 drush_print("Current Object: {$objectPID}");
 try {
     // Regenerate the TECHMD datastream
     drush_print("Regenerating TECHMD");
     $fitsResult = islandora_fits_create_techmd($object, $forceGeneration, array('source_dsid' => 'OBJ', 'destination_dsid' => 'TECHMD', 'weight' => '0.01', 'function' => array('islandora_fits_create_techmd'), 'file' => '/var/www/drupal/htdocs/sites/all/modules/islandora_fits/includes/derivatives.inc'));
     // check to make sure the result was successful as reported by the function
     if ($fitsResult['success'] != 1) {
         print "\n\n**ERROR generating TECHMD datastream for {$objectPID}\n";
         print_r($fitsResult);
     }
     // Regen the FULL_TEXT datastream
     drush_print("Regenerating FULL_TEXT");
     $fulltextResult = islandora_pdf_add_fulltext_derivative($object, $forceGeneration);
     // check to make sure the result was successful as reported by the function
     if ($fulltextResult['success'] != 1) {
         print "\n\n**ERROR generating FULL_TEXT datastream for {$objectPID}\n";
         print_r($fulltextResult);
     }
     // Regen the TN datastream
     drush_print("Regenerating TN");