           printf(fname);
 
           string record_id = compute_feature_correlation(study1, study2, cutoff[0], cutoff[1], fname);
-          int h = hash(record_id);
+          int h = string2int(record_id);
           params[h] = [record_id, fname, study1];
         }
       }
     }
 
-    // for each of the studies, run against full features, no xcorr
-    log_code = log_corr_template % (db_file, "", study1, "", -1, -1);
-    record_id = python_persist(log_code, "str(record_id)");
-    int h = hash(record_id);
-    params[h] = [record_id, "", study1];
+     // for each of the studies, run against full features, no xcorr
+    string log_code = log_corr_template % (db_file, "", study1, "", -1, -1);
+    string record_id = python_persist(log_code, "str(record_id)");
+    // give full features key value guaranteed to be lower than the record_ids 
+    // of the xcorr studies
+    params[-(i + 1)] = [record_id, "", study1];
   }
 
   int ME_ranks[];

  }

  assert(size(ME_ranks) == size(params), "Number of ME ranks must equal number of xcorrs");
  int keys[] = keys_integer(params);

  int modulo_prio = size(ME_ranks);
  foreach hash_index, r in keys
  {
    string ps[] = params[hash_index];
    int rank = ME_ranks[r];
    // initial priority, modulo priority, rank, record_id, feature file name, study1 name
    start(-r - 1, modulo_prio, rank, ps[0], ps[1], ps[2]);
  }
}

    }
}

(int keys[]) sort_keys(string params[][]) {
  sort_code =
"""
key_string = '%s'
keys = [int(x) for x in key_string.split(',')]
keys.sort()
result = ",".join([str(x) for x in keys])
""";

  string k[] = keys_string(params);
  string code = sort_code % (join(k, ","));
  result = python_persist(code, "result");
  foreach val, i in split(result, ",")
  {
    keys[i] = string2int(val);
  }
}

main() {
  string params[][];
  
  foreach study1, i in studies
  {
    foreach study2 in studies
    {
      if (study1 != study2)
      {
        foreach cutoff in cutoffs
