diff --git a/Load.py b/Load.py
index a26a487b4a4b7ff7f62f6cf9ae568ecfd0b91890..094c280b91a836c6c200e753ac57fb7b761fc624 100644
--- a/Load.py
+++ b/Load.py
@@ -453,7 +453,7 @@ def load(fields, runNB, proposalNB, subFolder='raw', display=False, validate=Fal
     return result
 
 def concatenateRuns(runs):
-    """ Concatenate a list of two runs with identical data variables along the
+    """ Sorts and concatenate a list of runs with identical data variables along the
         trainId dimension.
         
         Input:
@@ -461,12 +461,16 @@ def concatenateRuns(runs):
         Output:
             a concatenated xarray Dataset
     """
-    keys = sorted(runs[0].keys())
-    for run in runs[1:]:
-        if sorted(run.keys()) != keys:
+    firstTid = {i: int(run.trainId[0].values) for i,run in enumerate(runs)}
+    orderedDict = dict(sorted(firstTid.items(), key=lambda t: t[1]))
+    orderedRuns = [runs[i] for i in orderedDict]
+    keys = orderedRuns[0].keys()
+    for run in orderedRuns[1:]:
+        if run.keys() != keys:
             print('data fields between different runs are not identical. Cannot combine runs.')
             return
     
-    result = xr.concat(runs, dim='trainId')
-    result = result.sortby(result.trainId)
+    result = xr.concat(orderedRuns, dim='trainId')
+    result.attrs['run'] = [run.attrs['run'] for run in orderedRuns]
+    result.attrs['runFolder'] = [run.attrs['runFolder'] for run in orderedRuns]
     return result