Index: /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
===================================================================
--- /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java	(revision 1709)
+++ /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java	(revision 1710)
@@ -79,4 +79,5 @@
 	public static int nThreads;
 	public static boolean harmonizeSequences;
+	public static boolean loadSubstutionMatrix;
 	
 
@@ -127,5 +128,4 @@
 		this.preparationTaskHandlingStrategy = new TaskHandlingStrategy(
 				minimalTaskEquality);
-
 	}
 
@@ -140,4 +140,47 @@
 	}
 
+	public void saveAppData(String name) {
+		String objectName = name;
+		String filename = name + ".dat";
+		Object dataObject = GlobalDataContainer.getInstance().getData(
+				objectName);
+		if (dataObject == null) {
+			CommandHelpers.objectNotFoundMessage(objectName);
+		}
+		FileOutputStream fos = null;
+		ObjectOutputStream out = null;
+		try {
+			fos = new FileOutputStream(filename);
+			out = new ObjectOutputStream(fos);
+			out.writeObject(dataObject);
+			out.close();
+		} catch (IOException ex) {
+			Console.logException(ex);
+		}
+	}
+	
+	public RuleApplicationData loadAppData(String name) {
+		String objectName = name;
+		String filename = name + ".dat";
+	
+		Object data = null;
+		FileInputStream fis = null;
+		ObjectInputStream in = null;
+		try {
+			fis = new FileInputStream(filename);
+			in = new ObjectInputStream(fis);
+			data = in.readObject();
+			in.close();
+		} catch (IOException ex) {
+			Console.logException(ex);
+		} catch (ClassNotFoundException ex) {
+			Console.logException(ex);
+		}
+		if (GlobalDataContainer.getInstance().addData(objectName, data)) {
+			CommandHelpers.dataOverwritten(objectName);
+		}
+		return (RuleApplicationData) GlobalDataContainer.getInstance().getData(name);
+	}
+	
 	/*
 	 * (non-Javadoc)
@@ -151,50 +194,27 @@
 		RuleApplicationData appData = new RuleApplicationData(sessions);
 		if(SequenceForTaskDetectionRuleAlignment.harmonizeSequences) {
+			//appData.getStopWatch().start("harmonization");
 			harmonizeEventTaskInstancesModel(appData);
+			//appData.getStopWatch().stop("harmonization");
+			GlobalDataContainer.getInstance().addData("harmonized", appData);
+			//Saving intermediate results to file
+			Console.traceln(Level.INFO,"saving substitution matrix to file");
+			saveAppData("harmonized");
+		}
+		else {
+			Console.traceln(Level.INFO,"loading substitution matrix from file");
+			appData = loadAppData("harmonized");
+		}
+	
+		if(!SequenceForTaskDetectionRuleAlignment.loadSubstutionMatrix) {	
 			Console.traceln(Level.INFO, "generating substitution matrix from " + appData.getUniqueTasks().size() + " unique tasks");
+			appData.getStopWatch().start("substitution matrix");
 			appData.getSubmat().generate(appData.getUniqueTasks());
 			appData.getStopWatch().stop("substitution matrix");
-			GlobalDataContainer.getInstance().addData("appData", appData);
-			//Saving intermediate results to file
-			Console.traceln(Level.INFO,"saving substitution matrix to file");
-			String objectName = "appData";
-			String filename = "appData.dat";
-			Object dataObject = GlobalDataContainer.getInstance().getData(
-					objectName);
-			if (dataObject == null) {
-				CommandHelpers.objectNotFoundMessage(objectName);
-			}
-			FileOutputStream fos = null;
-			ObjectOutputStream out = null;
-			try {
-				fos = new FileOutputStream(filename);
-				out = new ObjectOutputStream(fos);
-				out.writeObject(dataObject);
-				out.close();
-			} catch (IOException ex) {
-				Console.logException(ex);
-			}
+			GlobalDataContainer.getInstance().addData("substitution", appData);
+			saveAppData("substitution");
 		}
 		else {
-			Console.traceln(Level.INFO,"loading substitution matrix from file");
-			String objectName = "appData";
-			String filename = "appData.dat";
-			Object data = null;
-			FileInputStream fis = null;
-			ObjectInputStream in = null;
-			try {
-				fis = new FileInputStream(filename);
-				in = new ObjectInputStream(fis);
-				data = in.readObject();
-				in.close();
-			} catch (IOException ex) {
-				Console.logException(ex);
-			} catch (ClassNotFoundException ex) {
-				Console.logException(ex);
-			}
-			if (GlobalDataContainer.getInstance().addData(objectName, data)) {
-				CommandHelpers.dataOverwritten(objectName);
-			}
-			appData = (RuleApplicationData) GlobalDataContainer.getInstance().getData("appData");
+			appData = loadAppData("substitution");
 		}
 		
@@ -204,5 +224,5 @@
 			Console.traceln(Level.INFO, "Iteration Number: " + iteration);
 			iteration++;
-			
+	
 			appData.detectedAndReplacedTasks = false;
 			appData.getStopWatch().start("whole loop");
Index: /branches/autoquest-ui-core-alignment/src/main/java/de/ugoe/cs/autoquest/commands/usability/CMDgenerateTaskTree.java
===================================================================
--- /branches/autoquest-ui-core-alignment/src/main/java/de/ugoe/cs/autoquest/commands/usability/CMDgenerateTaskTree.java	(revision 1709)
+++ /branches/autoquest-ui-core-alignment/src/main/java/de/ugoe/cs/autoquest/commands/usability/CMDgenerateTaskTree.java	(revision 1710)
@@ -45,5 +45,5 @@
 	@Override
 	public String help() {
-		return "generateTaskTree <sequences> {<tasktree>} {<boolean: harmonize sequences or not (true or false)>} {<integer: number of threads>}";
+		return "generateTaskTree <sequences> {<tasktree>} {<boolean: harmonize sequences or not (true or false)>} {boolean: load substitutionmatrix} {<integer: number of threads>}";
 	}
 
@@ -71,12 +71,17 @@
 			String harmonize = (String) parameters.get(2);
 			de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.harmonizeSequences = true;
-			System.out.println(harmonize);
-			if (harmonize.equals("false")) {
-				System.out.println("Not harmonizing");
+			if (harmonize.equals("false")) {	
 				de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.harmonizeSequences = false;
 			}
 		}
 		if (parameters.size() > 3) {
-			String threadCount = (String) parameters.get(3);
+			String loadSubMat = (String) parameters.get(3);
+			de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.loadSubstutionMatrix = false;
+			if (loadSubMat.equals("true")) {
+				de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.loadSubstutionMatrix = true;
+			}
+		}
+		if (parameters.size() > 4) {
+			String threadCount = (String) parameters.get(4);
 			de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.nThreads = 1;
 			try {
@@ -85,7 +90,9 @@
 			} catch (Exception e) {
 				throw new IllegalArgumentException(
-						"The fourth parameter must be an integer. Did you forget to name the tasktree?");
+						"The fifth parameter must be an integer. Did you forget to name the tasktree?");
 			}
 		}
+		
+		de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.loadSubstutionMatrix=false;
 
 		Collection<List<Event>> sequences = null;
Index: /branches/java-utils-alignment/src/main/java/de/ugoe/cs/util/StopWatch.java
===================================================================
--- /branches/java-utils-alignment/src/main/java/de/ugoe/cs/util/StopWatch.java	(revision 1709)
+++ /branches/java-utils-alignment/src/main/java/de/ugoe/cs/util/StopWatch.java	(revision 1710)
@@ -213,7 +213,12 @@
      * internally used to store splits
      */
-    private static class Split {
-        
-        /**
+    private static class Split implements Serializable {
+        
+        /**
+		 * 
+		 */
+		private static final long serialVersionUID = 7767677492954506604L;
+
+		/**
          * the id of the split
          */
