Index: /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NumberSequence.java
===================================================================
--- /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NumberSequence.java	(revision 1659)
+++ /branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NumberSequence.java	(revision 1660)
@@ -44,5 +44,30 @@
 	}
 
-	// Searching occurrences of
+	//Recursive check if sequence contains pattern at position i
+	public boolean matches(int i, int[] p1, int[] p2 ,int ip1,int ip2) {
+		
+		if(p1.length==ip1) {
+			return true;
+		}
+		if(p2.length==ip2) {
+			return true;
+		}
+		if(i==sequence.length) {
+			return false;
+		}
+		if(p1[ip1]==sequence[i]||p2[ip2]==sequence[i]) {
+			return matches(i+1,p1,p2,ip1+1,ip2+1);
+		}
+		if(p1[ip1]==-1) {
+			return matches(i,p1,p2,ip1+1,ip2);
+		}
+		if(p2[ip2]==-1) {
+			return matches(i,p1,p2,ip1,ip2+1);
+		}
+		return false;
+	}
+	
+	//Searching occurrences of pattern
+
 	public LinkedList<Integer> containsPattern(Match pattern) {
 		LinkedList<Integer> result = new LinkedList<Integer>();
@@ -50,38 +75,8 @@
 		int[] pat1 = pattern.getFirstSequence().getSequence();
 		int[] pat2 = pattern.getSecondSequence().getSequence();
-		notmatched: while (i <= sequence.length - pat1.length) {
-			if (sequence[i] == pat1[0] || sequence[i] == pat2[0]) {
-				int ipat1 = 0;
-				int ipat2 = 0;
-				int optcount1 = 0;
-				int optcount2 = 0;
-				while (ipat1 < pat1.length
-						&& ipat2 < pat2.length) {
-					
-						if (pat1[ipat1] == -1) {
-							ipat1++;
-							optcount1++;
-							continue;
-						}
-					
-						if (pat2[ipat2] == -1) {
-							ipat2++;
-							optcount2++;
-							continue;
-						}
-					
 
-					if (sequence[i + ipat1 - optcount1] != pat1[ipat1]
-							&& sequence[i + ipat2 - optcount2] != pat2[ipat2]) {
-						i++;
-						// System.out.println(sequence[i+ipat1-optcount1] +
-						// " != " + pat1[ipat1] + " || " +
-						// sequence[i+ipat2-optcount2] + " != " + pat2[ipat2]);
-						continue notmatched;
-					}
-						ipat1++;
-						ipat2++;
-				}
-				
+		while (i < sequence.length ) {
+			if(matches(i,pat1,pat2,0,0)) {
+				System.out.println(i);
 				result.add(i);
 				System.out.println("FOUND MATCH AT: " + i);
