Index: branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentAlgorithmFactory.java
===================================================================
--- branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentAlgorithmFactory.java	(revision 1587)
+++ branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentAlgorithmFactory.java	(revision 1588)
@@ -8,5 +8,5 @@
 	public static AlignmentAlgorithm create(int[] input1, int[] input2, SubstitutionMatrix submat,float threshold) {
 		
-		//return new NeedlemanWunsch(input1,input2,submat,threshold);
+		//return new SmithWaterman(input1,input2,submat,threshold);
 		return new NeedlemanWunsch(input1,input2,submat,threshold);
 		//return new SmithWatermanRepeated(input1,input2,submat,threshold);
Index: branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NeedlemanWunsch.java
===================================================================
--- branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NeedlemanWunsch.java	(revision 1587)
+++ branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NeedlemanWunsch.java	(revision 1588)
@@ -2,9 +2,10 @@
 
 import java.util.ArrayList;
-import java.util.logging.Level;
+import java.util.Iterator;
+import java.util.LinkedList;
 
 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix;
 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants;
-import de.ugoe.cs.util.console.Console;
+
 
 public class NeedlemanWunsch implements AlignmentAlgorithm {
@@ -116,5 +117,5 @@
 
 				matrix[i][j].setScore(Math.max(diagScore,
-						Math.max(upScore, Math.max(leftScore, 0))));
+						Math.max(upScore, leftScore)));
 
 				// find the directions that give the maximum scores.
@@ -175,28 +176,29 @@
 	public void traceback() {
 		MatrixEntry tmp = matrix[length1][length2];
-		int aligned1[] = new int[length1 + length2 + 2];
-		int aligned2[] = new int[length1 + length2 + 2];
+		LinkedList<Integer> aligned1 = new LinkedList<Integer>();
+		LinkedList<Integer> aligned2 = new LinkedList<Integer>();
+		do {
+			
+			aligned1.add(new Integer(tmp.getXvalue()));
+			aligned2.add(new Integer(tmp.getYvalue()));
+
+			tmp = tmp.getPrevious();
+
+		} while (tmp != null);
+		
+		// reverse order of the alignment
+		int reversed1[] = new int[aligned1.size()];
+		int reversed2[] = new int[aligned2.size()];
+
 		int count = 0;
-		do {
-			if (length1 + length2 + 2 == count) {
-				Console.traceln(Level.WARNING,
-						"Traceback longer than both sequences summed up!");
-				break;
-			}
-			aligned1[count] = tmp.getXvalue();
-			aligned2[count] = tmp.getYvalue();
-
-			tmp = tmp.getPrevious();
+		for (Iterator<Integer> it = aligned1.descendingIterator(); it.hasNext();) {
 			count++;
-
-		} while (tmp != null);
-		count--;
-		// reverse order of the alignment
-		int reversed1[] = new int[count];
-		int reversed2[] = new int[count];
-
-		for (int i = count; i > 0; i--) {
-			reversed1[reversed1.length - i] = aligned1[i];
-			reversed2[reversed2.length - i] = aligned2[i];
+			reversed1[reversed1.length - count] = it.next();
+			
+		}
+		count = 0;
+		for (Iterator<Integer> it = aligned2.descendingIterator(); it.hasNext();) {
+			count++;
+			reversed2[reversed2.length - count] = it.next();
 		}
 
@@ -216,4 +218,5 @@
 		int count = 0;
 		do {
+			System.out.println(tmp);
 			String append1 = "";
 			String append2 = "";
Index: branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/pal/tree/UPGMAAligningTree.java
===================================================================
--- branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/pal/tree/UPGMAAligningTree.java	(revision 1587)
+++ branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/pal/tree/UPGMAAligningTree.java	(revision 1588)
@@ -217,4 +217,5 @@
 			int seqCount2 = node2.getSequences().size();
 			
+			/*
 			for(int i = 0; i < seqCount1; i++) {
 				for(int j = 0; j < seqCount2; j++) {
@@ -223,4 +224,5 @@
 				}
 			}
+			*/
 			
 			Console.traceln(Level.INFO,"Merging node " + node1.getIdentifier() + " with " + node2.getIdentifier());
