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 1747)
+++ branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java	(revision 1749)
@@ -25,5 +25,4 @@
 import java.util.List;
 import java.util.Map;
-import java.util.PriorityQueue;
 import java.util.Queue;
 import java.util.Set;
@@ -73,11 +72,12 @@
 
     /** The n threads. */
-    // public static int nThreads = Runtime.getRuntime().availableProcessors() - 1;
-    public static int nThreads = 1;
+    public static int nThreads = Runtime.getRuntime().availableProcessors() - 1;
+    //public static int nThreads = 1;
 
     /** The iteration. */
     private int iteration = 0;
 
-    private int maxIterations = 1;
+    private int maxIterations = 10
+            ;
 
     private static int alignmentThreshold = 9;
@@ -148,7 +148,7 @@
 
         Console.traceln(Level.INFO, "generating substitution matrix from " +
-            appData.getUniqueTasks().size() + " unique tasks");
+            appData.getNumber2Task().size() + " unique tasks");
         appData.getStopWatch().start("substitution matrix");
-        appData.getSubmat().generate(appData.getUniqueTasks());
+        appData.getSubmat().generate(appData.getNumber2Task().values());
         appData.getStopWatch().stop("substitution matrix");
 
@@ -358,5 +358,4 @@
                 if (task == null) {
                     uniqueTasks.addSymbol(taskInstance, taskInstance.getTask());
-                    appData.getUniqueTasks().add(taskInstance.getTask());
                     appData.getNumber2Task().put(taskInstance.getTask().getId(),
                                                  taskInstance.getTask());
@@ -372,5 +371,5 @@
         appData.getStopWatch().stop("harmonizing event tasks");
         Console.traceln(Level.INFO, "harmonized " + unifiedTasks + " task occurrences (still " +
-            appData.getUniqueTasks().size() + " different tasks)");
+            uniqueTasks.size() + " different tasks)");
 
         appData.getStopWatch().dumpStatistics(System.out);
@@ -708,4 +707,5 @@
             e.printStackTrace();
         }
+        appData.getPreparedTasks().clear();
     }
 
@@ -1008,5 +1008,5 @@
         public void run() {
             for (int i = from; i <= to; i++) {
-                System.out.println("Replacing in SEQUENCE " + i);
+                //System.out.println("Replacing in SEQUENCE " + i);
                 /*
                  * HashMap for keeping track in which sequence which replacement has been performed.
@@ -1062,6 +1062,6 @@
                    
 
-                    System.out.println("Replacing in Sequence " + oc.getSequenceId() +
-                        " at position " + oc.getStartindex() + " till " + oc.getEndindex());
+                    //System.out.println("Replacing in Sequence " + oc.getSequenceId() +
+                    //    " at position " + oc.getStartindex() + " till " + oc.getEndindex());
                     final ISequenceInstance sequenceInstances =
                         RuleUtils.createNewSubSequenceInRange(appData.getSessions()
@@ -1116,9 +1116,4 @@
         private final HashMap<Integer, ITask> number2task;
 
-        /**
-         * The unique tasks, keeps track about all unique tasks TODO: We Actually just need
-         * number2task here, this structure can be removed in the future.
-         */
-        private final HashSet<ITask> uniqueTasks;
 
         /**
@@ -1168,5 +1163,4 @@
             this.sessions = sessions;
             numberseqs = new ArrayList<NumberSequence>();
-            uniqueTasks = new HashSet<ITask>();
             number2task = new HashMap<Integer, ITask>();
             stopWatch = new StopWatch();
@@ -1271,13 +1265,4 @@
 
         /**
-         * Gets the unique tasks.
-         *
-         * @return the unique tasks
-         */
-        private HashSet<ITask> getUniqueTasks() {
-            return uniqueTasks;
-        }
-
-        /**
          * New task created.
          *
@@ -1295,5 +1280,4 @@
          */
         synchronized private void resetNewlyCreatedTasks() {
-            uniqueTasks.addAll(newTasks);
             newTasks.clear();
         }
