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 1742)
+++ branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleUtils.java	(revision 1743)
@@ -16,4 +16,5 @@
 
 import de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.IStructuringTemporalRelationship;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance;
@@ -64,19 +65,37 @@
 		final ISequenceInstance subsequence = taskFactory
 				.createNewTaskInstance(model);
-		// TODO: Debugging output
 		/*
-		int modelid = model.getId();
-		if(modelid == 5412) {
-			System.out.println("Printing session: ");
-			for (int i = 0; i < parent.size();i++) {
-				System.out.println(parent.get(i));
+		System.out.println("PRINTING MODEL: ");
+		for (int i = 0; i < subsequence.getSequence().getChildren().size(); i++) {
+			System.out.println(subsequence.getSequence().getChildren().get(i));
+
+			if (subsequence.getSequence().getChildren().get(i).getType() == "selection") {
+				for (int j = 0; j < ((ISelection) subsequence.getSequence()
+						.getChildren().get(i)).getChildren().size(); j++) {
+					if (((IStructuringTemporalRelationship) subsequence
+							.getSequence().getChildren().get(i)).getChildren()
+							.get(j).getType() == "sequence") {
+						ISequence foo = (ISequence) ((ISelection) (subsequence
+								.getSequence().getChildren().get(i)))
+								.getChildren().get(j);
+						System.out.println("\t" + foo);
+						for (int k = 0; k < foo.getChildren().size(); k++) {
+							System.out.println("\t\t"
+									+ foo.getChildren().get(k));
+						}
+						System.out.println();
+					} else {
+						System.out.println("\t"
+								+ ((ISelection) subsequence.getSequence()
+										.getChildren().get(i)).getChildren()
+										.get(j));
+					}
+
+				}
 			}
-			System.out.println("startIndex: " + startIndex + " endIndex: " + endIndex + "\n");
-			System.out.println("Printing model: ");
-			for(int i = 0; i < ((ISequence)model).getChildren().size();i++) {
-				System.out.println((ISequence)model.getChildren().get(i));		
-			}
-			
-		}*/
+
+		}
+		System.out.println();
+                */
 		// TODO: This is dirty, return this in addition with the sequence
 		// instance instead
@@ -89,5 +108,5 @@
 			}
 			final ITask tempTask = model.getChildren().get(modelindex);
-			// System.out.println("Trying to add " + parent.get(startIndex)
+			//System.out.println("Trying to add " + parent.get(startIndex)
 			// + " to the model instance " + tempTask);
 			if (tempTask.getType() == "optionality") {
@@ -111,38 +130,82 @@
 				}
 			} else if (tempTask instanceof ISelection) {
-				final ISelectionInstance selection = taskFactory.createNewTaskInstance((ISelection) tempTask);
+				final ISelectionInstance selection = taskFactory
+						.createNewTaskInstance((ISelection) tempTask);
 				final ISelection tmpSel = (ISelection) tempTask;
-				//Check if the selection has 2 sequences as children
-				if ((tmpSel.getChildren().get(0) instanceof ISequence) && (tmpSel.getChildren().get(1) instanceof ISequence)) {
+				if (tmpSel.getChildren().size() == 0) {
+					try {
+						throw new Exception("Selection without children");
+					} catch (Exception e) {
+						e.printStackTrace();
+					}
+				}
+				// Check if the selection has 2 sequences as children
+				// TODO: This segment is a mess, clean it up.
+				if ((tmpSel.getChildren().get(0) instanceof ISequence)
+						&& (tmpSel.getChildren().get(1) instanceof ISequence)) {
 					ISequenceInstance selseq = null;
-					// The selection I create can just have 2 children, we need to check here, to which sequence of the model this occurence belongs
-					//This if checks of the occurrence is equal to the first element of the first sequence in the model
-					if (parent.get(startIndex).getTask().equals(((ISequence) tmpSel.getChildren().get(0)).getChildren().get(0))) {
-						selseq = taskFactory.createNewTaskInstance((ISequence) tmpSel.getChildren().get(0));
-					//This if checks of the occurrence is equal to the first element of the second sequence in the model						
-					} else if (parent.get(startIndex).getTask().equals(((ISequence) tmpSel.getChildren().get(1)).getChildren().get(0))) {
-						selseq = taskFactory.createNewTaskInstance((ISequence) tmpSel.getChildren().get(1));
-					//If the occurence is already a sequence we don't need to do anything, the next iteration will detect this as a sequence and add it
-					} else if ((parent.get(startIndex).getTask().equals(tmpSel.getChildren().get(0).getId()))
-							|| (parent.get(startIndex).getTask().equals(tmpSel.getChildren().get(1).getId()))) {
+					// The selection I create can just have 2 children, we need
+					// to check here, to which sequence of the model this
+					// occurence belongs
+					// This if checks of the occurrence is equal to the first
+					// element of the first sequence in the model
+					if (parent
+							.get(startIndex)
+							.getTask()
+							.equals(((ISequence) tmpSel.getChildren().get(0))
+									.getChildren().get(0))) {
+						selseq = taskFactory
+								.createNewTaskInstance((ISequence) tmpSel
+										.getChildren().get(0));
+						for (int k = 0; k < selseq.getSequence().getChildren()
+								.size(); k++) {
+							taskBuilder
+									.addChild(selseq, parent.get(startIndex));
+							taskBuilder.removeTaskInstance(parent, startIndex);
+							i++;
+						}
+						taskBuilder.setChild(selection, selseq);
+						taskBuilder.addChild(subsequence, selection);
+						modelindex++;
+						continue;
+					}
+					// This if checks of the occurrence is equal to the first
+					// element of the second sequence in the model
+					else if (parent
+							.get(startIndex)
+							.getTask()
+							.equals(((ISequence) tmpSel.getChildren().get(1))
+									.getChildren().get(0))) {
+						selseq = taskFactory
+								.createNewTaskInstance((ISequence) tmpSel
+										.getChildren().get(1));
+						for (int k = 0; k < selseq.getSequence().getChildren()
+								.size(); k++) {
+							taskBuilder
+									.addChild(selseq, parent.get(startIndex));
+							taskBuilder.removeTaskInstance(parent, startIndex);
+							i++;
+						}
+						taskBuilder.setChild(selection, selseq);
+						taskBuilder.addChild(subsequence, selection);
+						modelindex++;
+						continue;
+					}
+					// If the occurrence is already a sequence wedon't need to
+					// do anything, the next iteration will detect this as a
+					// sequence and add it
+					else if ((parent.get(startIndex).getTask().equals(tmpSel
+							.getChildren().get(0)))
+							|| (parent.get(startIndex).getTask().equals(tmpSel
+									.getChildren().get(1)))) {
 						taskBuilder.setChild(selection, parent.get(startIndex));
 						taskBuilder.addChild(subsequence, selection);
-						taskBuilder.removeTaskInstance(parent, startIndex);
+						taskBuilder.removeTaskInstance(parent,startIndex);
 						modelindex++;
 						continue;
-						
-					}
-					//TODO: Sometimes nullpointer exception here :(
-					for (int k = 0; k < ((ISequence)tmpSel.getChildren().get(0)).getChildren().size(); k++) {
-						taskBuilder.addChild(selseq, parent.get(startIndex));
-						taskBuilder.removeTaskInstance(parent, startIndex);
-						i++;
-					}
-					taskBuilder.setChild(selection, selseq);
-					taskBuilder.addChild(subsequence, selection);
-					modelindex++;
-					continue;
-				//It is just a plain selection
-				} else {
+					}
+				}
+				// It is just a plain selection
+				else {
 					taskBuilder.setChild(selection, parent.get(startIndex));
 					taskBuilder.addChild(subsequence, selection);
@@ -160,5 +223,4 @@
 
 		taskBuilder.addTaskInstance(parent, startIndex, subsequence);
-	
 
 		return subsequence;
@@ -227,7 +289,7 @@
 				// Thread.currentThread().getName() + ": " + Math.round((float)
 				// count/size*100))+ "%");
-				 System.out.println(message + " in thread "
-				 + Thread.currentThread().getName() + ": "
-				 + Math.round(((float) count / size) * 100) + "%");
+				// System.out.println(message + " in thread "
+				// + Thread.currentThread().getName() + ": "
+				// + Math.round(((float) count / size) * 100) + "%");
 			}
 		} else {
@@ -235,7 +297,7 @@
 			// Thread.currentThread().getName() + ": " +Math.round((float)
 			// count/size*100))+ "%");
-			 System.out.println(message + " in thread "
-			 + Thread.currentThread().getName() + ": "
-			 + Math.round(((float) count / size) * 100) + "%");
+			// System.out.println(message + " in thread "
+			// + Thread.currentThread().getName() + ": "
+			// + Math.round(((float) count / size) * 100) + "%");
 
 		}
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 1742)
+++ branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java	(revision 1743)
@@ -75,5 +75,6 @@
 
 	/** The n threads. */
-	public static int nThreads = Runtime.getRuntime().availableProcessors() - 1;
+	//public static int nThreads = Runtime.getRuntime().availableProcessors() - 1;
+	public static int nThreads = 1;
 
 	/** The iteration. */
