Index: /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Match.java
===================================================================
--- /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Match.java	(revision 1654)
+++ /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Match.java	(revision 1655)
@@ -60,10 +60,9 @@
 	}
 
-	/*
+	
 	public void addOccurencesOf(Match m) {
-		LinkedList<MatchOccurence> occ = m.getOccurences();
-		occurences.addAll(occ);
+		occurences.addAll(m.getOccurences());
 	}
-	*/
+	
 	
    
Index: /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/PairwiseAlignmentGenerator.java
===================================================================
--- /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/PairwiseAlignmentGenerator.java	(revision 1654)
+++ /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/PairwiseAlignmentGenerator.java	(revision 1655)
@@ -31,5 +31,7 @@
 							smithWatermanThreshold);
 					alignments.set(i, j, aa);
-
+					//TODO: This is old code used for generating pairwise distances between alignments (to build
+					// a guide tree
+					/*
 					AlignmentAlgorithm sameSequence1 = AlignmentAlgorithmFactory
 							.create();
@@ -45,5 +47,5 @@
 							.shuffle(), submat,
 							smithWatermanThreshold);
-
+					
 					// Score of the aligmnment
 					double score = alignments.get(i, j).getAlignmentScore();
@@ -69,4 +71,5 @@
 						}
 					}
+					*/
 				}
 			}
Index: /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleUtils.java
===================================================================
--- /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleUtils.java	(revision 1654)
+++ /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleUtils.java	(revision 1655)
@@ -17,6 +17,9 @@
 import java.util.Iterator;
 
+import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance;
@@ -32,109 +35,117 @@
  */
 class RuleUtils {
-    
-    /**
-     * <p>
-     * counter for generating unique ids. Starts at 0 for each new program start
-     * </p>
-     */
-    private static int idCounter = 0;
 
-    /**
-     * <p>
-     * generates a sub sequence for a specified range of elements in the provided task instances
-     * list.
-     * </p>
-     *
-     * @param parent      the list of which the range shall be extracted
-     * @param startIndex  the start index of the range
-     * @param endIndex    the end index of the range (inclusive)
-     * @param model       the task model (required for instantiating the sub sequence)
-     * @param taskFactory the task factory used for instantiating the sub sequence
-     * @param taskBuilder the task builder to perform changes in the task structure
-     * 
-     * @return a task instance representing the requested sub sequence
-     */
-    static ITaskInstance getSubSequenceInRange(ITaskInstanceList parent,
-                                               int               startIndex,
-                                               int               endIndex,
-                                               ISequence         model,
-                                               ITaskFactory      taskFactory,
-                                               ITaskBuilder      taskBuilder)
-    {
-        ISequenceInstance subsequence = taskFactory.createNewTaskInstance(model);
+	/**
+	 * <p>
+	 * counter for generating unique ids. Starts at 0 for each new program start
+	 * </p>
+	 */
+	private static int idCounter = 0;
 
-        for (int i = startIndex; i <= endIndex; i++) {
-            taskBuilder.addChild(subsequence, parent.get(i));
-        }
+	/**
+	 * <p>
+	 * generates a sub sequence for a specified range of elements in the
+	 * provided task instances list.
+	 * </p>
+	 *
+	 * @param parent
+	 *            the list of which the range shall be extracted
+	 * @param startIndex
+	 *            the start index of the range
+	 * @param endIndex
+	 *            the end index of the range (inclusive)
+	 * @param model
+	 *            the task model (required for instantiating the sub sequence)
+	 * @param taskFactory
+	 *            the task factory used for instantiating the sub sequence
+	 * @param taskBuilder
+	 *            the task builder to perform changes in the task structure
+	 * 
+	 * @return a task instance representing the requested sub sequence
+	 */
+	static ITaskInstance getSubSequenceInRange(ITaskInstanceList parent,
+			int startIndex, int endIndex, ISequence model,
+			ITaskFactory taskFactory, ITaskBuilder taskBuilder) {
+		ISequenceInstance subsequence = taskFactory
+				.createNewTaskInstance(model);
 
-        return subsequence;
-    }
+		for (int i = startIndex; i <= endIndex; i++) {
+			taskBuilder.addChild(subsequence, parent.get(i));
+		}
 
-    /**
-     * <p>
-     * replaces a sub sequence for a specified range of elements in the provided task instances
-     * list by a sub task instance
-     * </p>
-     *
-     * @param parent      the list of which the range shall be replaced
-     * @param startIndex  the start index of the range
-     * @param endIndex    the end index of the range (inclusive)
-     * @param model       the task model (required for instantiating the sub sequence)
-     * @param taskFactory the task factory used for instantiating the sub sequence
-     * @param taskBuilder the task builder to perform changes in the task structure
-     * 
-     * @return the replacement for the range
-     */
-    static ISequenceInstance createNewSubSequenceInRange(ITaskInstanceList parent,
-                                                         int               startIndex,
-                                                         int               endIndex,
-                                                         ISequence         model,
-                                                         ITaskFactory      taskFactory,
-                                                         ITaskBuilder      taskBuilder)
-    {
-        ISequenceInstance subsequence = taskFactory.createNewTaskInstance(model);
-        
-       for (Iterator<ITaskInstance> it = subsequence.iterator();it.hasNext();) {
-    	   ITaskInstance foo =  it.next();
-    	   System.out.println(foo);
-       }
-        
-        System.out.println("Got model: " + model.toString());
-        
-       
-        
-        System.out.println(parent);
-        //System.out.println(parent.get(startIndex));
-        for (int i = startIndex; i <= endIndex; i++) {
-        	System.out.println("Trying to add "+ parent.get(startIndex) + " to the model");
-            taskBuilder.addChild(subsequence, parent.get(startIndex));
-            
-            taskBuilder.removeTaskInstance(parent, startIndex);
-        }
+		return subsequence;
+	}
 
-        taskBuilder.addTaskInstance(parent, startIndex, subsequence);
+	/**
+	 * <p>
+	 * replaces a sub sequence for a specified range of elements in the provided
+	 * task instances list by a sub task instance
+	 * </p>
+	 *
+	 * @param parent
+	 *            the list of which the range shall be replaced
+	 * @param startIndex
+	 *            the start index of the range
+	 * @param endIndex
+	 *            the end index of the range (inclusive)
+	 * @param model
+	 *            the task model (required for instantiating the sub sequence)
+	 * @param taskFactory
+	 *            the task factory used for instantiating the sub sequence
+	 * @param taskBuilder
+	 *            the task builder to perform changes in the task structure
+	 * 
+	 * @return the replacement for the range
+	 */
+	static ISequenceInstance createNewSubSequenceInRange(
+			ITaskInstanceList parent, int startIndex, int endIndex,
+			ISequence model, ITaskFactory taskFactory, ITaskBuilder taskBuilder) {
+		ISequenceInstance subsequence = taskFactory
+				.createNewTaskInstance(model);
 
-        return subsequence;
-    }
+		int modelindex=0;
+		for (int i = startIndex; i <= endIndex; i++) {
+			System.out.println("Trying to add " + parent.get(startIndex)
+					+ " to the model instance");
+			ITask tempTask = model.getChildren().get(modelindex);
+			if (tempTask.getType() == "optionality") {
+					IOptionalInstance optional = taskFactory.createNewTaskInstance((IOptional) tempTask);
+			} else if (tempTask.getType() == "selection") {
 
-    /**
-     * <p>
-     * returns the next available id (uses the id counter)
-     * </p>
-     * 
-     * @return the next available id
-     */
-    static synchronized String getNewId() {
-        return Integer.toString(idCounter++);
-    }
+			} else if (tempTask.getType() == "sequence") {
+				taskBuilder.addChild(subsequence, parent.get(startIndex));
+			} else if (tempTask.getType() == "iteration") {
 
-    /**
-     * <p>
-     * prevent instantiation
-     * </p>
-     */
-    private RuleUtils() {
-        // prevent instantiation
-    }
+			} else {
+
+			}
+			taskBuilder.removeTaskInstance(parent, startIndex);
+			modelindex++;
+		}
+
+		taskBuilder.addTaskInstance(parent, startIndex, subsequence);
+
+		return subsequence;
+	}
+
+	/**
+	 * <p>
+	 * returns the next available id (uses the id counter)
+	 * </p>
+	 * 
+	 * @return the next available id
+	 */
+	static synchronized String getNewId() {
+		return Integer.toString(idCounter++);
+	}
+
+	/**
+	 * <p>
+	 * prevent instantiation
+	 * </p>
+	 */
+	private RuleUtils() {
+		// prevent instantiation
+	}
 
 }
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 1654)
+++ /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java	(revision 1655)
@@ -208,4 +208,5 @@
 						int start = jt.next();
 						//TODO: Debug Output
+						/*
 						System.out.println("Found match ");
 						pattern.getFirstSequence().printSequence();
@@ -216,4 +217,5 @@
 							System.out.println(appData.getNumber2Task().get(tempns.getSequence()[k]));
 						}
+						*/
 						pattern.addOccurence(
 								new MatchOccurence(start, j));
