diff --git a/pift.cron.inc b/pift.cron.inc
index b3f0137..ddb0a48 100644
--- a/pift.cron.inc
+++ b/pift.cron.inc
@@ -29,15 +29,18 @@ function pift_cron_retest($quantity = NULL, $count_only_flag = FALSE, $projects
     // Retrieve last test for each issue
     $query = db_select('pift_data', 'pd');
 
+    // Ensure we only consider the last test for any issue
+    // TODO: Refactor this to use the file field ordering to determine the last test.
+    $subquery = db_select('pift_data', 'pd2');
+    $subquery->addExpression('MAX(pd2.test_id)', 'maxid');
+    $subquery->groupBy('nid');
+
     // Add required table joins
+    $query->innerjoin($subquery, 'maxids', 'pd.test_id = maxids.maxid');
     $query->join('node', 'n', 'pd.nid = n.nid');
     $query->join('field_data_field_issue_status', 'fdfis', 'n.nid = fdfis.entity_id AND n.type = fdfis.bundle');
     $query->join('field_data_field_project', 'fdfp', 'n.nid = fdfp.entity_id AND n.type = fdfp.bundle');
 
-    // Restrict to the last test in any given issue
-    $query->addExpression('MAX(test_id)', 'max_id');
-    $query->groupBy('pd.nid');
-
     // Restrict to $quantity recent file tests which have passed and not been
     // tested in the retest interval, ordered by oldest first.
     if (empty($quantity)) {
@@ -64,12 +67,13 @@ function pift_cron_retest($quantity = NULL, $count_only_flag = FALSE, $projects
     }
 
     // Execute query
+    $query->addField('pd', 'test_id', 'test_id');
     $result = $query->execute();
 
     $retest_candidates = array();
 
     foreach ($result as $record) {
-      $retest_candidates[] = $record->max_id;
+      $retest_candidates[] = $record->test_id;
       // TODO: Ensure test matches a valid API term
     }
 
@@ -95,10 +99,10 @@ function pift_cron_retest($quantity = NULL, $count_only_flag = FALSE, $projects
         ->condition('test_id', $retest_candidates, 'IN')
         ->execute();
       if (function_exists('drush_main')) {
-        drupal_set_message(t("Requeued %test_count new tests.", array('%test_count' => $updated)));
+        drupal_set_message(t("Queued retesting of %test_count previously passed tests.", array('%test_count' => $updated)));
       }
       else {
-        watchdog('pift', 'Requeued %test_count new tests.', array('%test_count' => $updated));
+        watchdog('pift', 'Queued retesting of %test_count previously passed tests.', array('%test_count' => $updated));
       }
     }
   }
