diff --git a/examples/actors/MergeActors.java b/examples/actors/MergeActors.java
new file mode 100644
index 0000000000000000000000000000000000000000..b37e10ffc53006af0a07b597d692e1fea0aee884
--- /dev/null
+++ b/examples/actors/MergeActors.java
@@ -0,0 +1,33 @@
+/* -*-Java-*- */                                         
+
+/*
+ * Copyright (C) 2009  Anders Nilsson <anders.nilsson@cs.lth.se>
+ *                                                              
+ * This file is part of Actors model compiler.                      
+ */                                                             
+
+import xdfAST.Start;
+import xdfAST.Instance;
+import java.util.HashSet;
+
+public class MergeActors extends XdfParser {
+	public static void main(String args[]) {
+		Start ast = parse(args);
+
+// 		ast.genSSR(System.out);
+// 		HashSet<Instance> l = ast.genStaticSchedule(new HashSet<Instance>());
+// 		System.out.println("\n\n");
+
+// 		for (Instance i: l){
+// 			do {
+// 				System.out.print(i.name()+" -> ");
+// 				i = i.next;
+// 			} while (i != null);
+// 			System.out.println();
+// 		}
+
+		ast.mergeActors();
+		ast.prettyPrint("",System.out);
+	}
+}
+
diff --git a/examples/actors/SSRAnalysis.java b/examples/actors/SSRAnalysis.java
index 021dd6124479c4baf3adea9c56d67e3dfabbd712..a99303f6fd2f6182069ccd7fcff5e85085a0d447 100644
--- a/examples/actors/SSRAnalysis.java
+++ b/examples/actors/SSRAnalysis.java
@@ -26,15 +26,45 @@ public class SSRAnalysis extends XdfParser {
 			System.out.println();
 		}
 
+		System.out.println("\n\n");		
 		String s = genScheduleXML(l);
+		System.out.println(s);
 	}
 
 
 	static String genScheduleXML(HashSet<Instance> set) {
 		StringBuffer sb = new StringBuffer();
+		int ind = 0;
 		sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
 		sb.append("<Schedule>\n");
+		ind++;
+		for (Instance i: set){
+			sb.append(ind(ind));
+			sb.append("<StaticSequence>\n");
+			ind++;
+			do {
+				sb.append(ind(ind));
+				sb.append("<Instance>");
+				sb.append(i.name());
+				sb.append("</Instance>\n");
+				i = i.next;
+			} while (i != null);
+			ind--;
+			sb.append(ind(ind));
+			sb.append("</StaticSequence>\n");
+		}		
+		ind--;
+		sb.append("</Schedule>\n");
+		
+
+		return sb.toString();
+	}
 
+	static String ind(int level) {
+		StringBuffer sb = new StringBuffer();
+		for (int i=0; i<level; i++) {
+			sb.append("  ");
+		}
 		return sb.toString();
 	}
 }
diff --git a/examples/actors/xdf/MergeActors.jrag b/examples/actors/xdf/MergeActors.jrag
new file mode 100644
index 0000000000000000000000000000000000000000..ec26de21363fedc20f7ed6c34e5cac9c57566168
--- /dev/null
+++ b/examples/actors/xdf/MergeActors.jrag
@@ -0,0 +1,74 @@
+/* -*-Java-*- */                                         
+
+/*
+ * Copyright (C) 2009  Anders Nilsson <anders.nilsson@cs.lth.se>
+ *                                                              
+ * This file is part of Actors model compiler.                      
+ */                                                             
+
+import java.util.HashSet;
+
+aspect MergeActors {
+	void Element.mergeActors() {}
+	public void Start.mergeActors() {
+		getSpecification().mergeActors();
+	}
+	void Specification.mergeActors() {
+		for (Element e : getElements()) {
+			e.mergeActors();
+		}
+	}
+	void XDF.mergeActors() {
+		HashSet<Instance> schedule = genStaticSchedule(new HashSet<Instance>());
+		HashSet<Connection> cons = getConnections(new HashSet<Connection>());
+		for (Instance i : schedule) {
+			while (i.next != null) {
+				for (Connection c : cons) {
+					if (c.getSource() == i && c.getDest() == i.next) {
+						// Check port names and perform actual actor
+						// merge. Then set remove_me flag so that this
+						// connection will be removed from the actor
+						// network.
+						c.remove_me = true;
+					}
+				}
+				i.setName(i.name()+"_"+i.next.name());
+				i.next = i.next.next;
+			}
+		}
+	}
+	void Connection.mergeActors() {
+		Instance src = getSource();
+		Instance dest = getDest();
+		if (dest.isSDF() && src.isSDF()) {		
+			src.merge(dest);
+			src.setName(src.name()+"_"+dest.name());
+		}
+	}
+
+	void Instance.merge(Instance inst) {}
+}
+
+aspect Misc {
+	syn HashSet<Connection> Element.getConnections(HashSet<Connection> set) = set;
+	eq XDF.getConnections(HashSet<Connection> set) {		
+		for (Element e : getElements()) {
+			set = e.getConnections(set);
+		}
+		return set;
+	}
+	eq Connection.getConnections(HashSet<Connection> set) {
+		set.add(this);
+		return set;
+	}
+}
+
+aspect Rewrites {
+	boolean Connection.remove_me = false;
+	
+	rewrite Connection {
+		when (remove_me) to ComplexElement {
+			return new ComplexElement();
+		}
+	}
+}
\ No newline at end of file
diff --git a/examples/actors/xdf/SSR.jrag b/examples/actors/xdf/SSR.jrag
index 5ebd9446ed345b7546432150546362ba27ba32cb..29bcbb62d6dd102533c31fb4900dc37e4c08563d 100644
--- a/examples/actors/xdf/SSR.jrag
+++ b/examples/actors/xdf/SSR.jrag
@@ -144,6 +144,10 @@ aspect misc {
 		return new Note(); // Probably better than returning null
 	}
 
+	void Instance.setName(String s) {
+		getUIDNote().setValue(s);
+	}
+
 	syn String Element.kind() = "";
 	eq Note.kind() {
 		for (Attribute a : getAttributes()) {
@@ -169,6 +173,14 @@ aspect misc {
 		return "";
 	}
 
+	void Note.setValue(String s) {
+		for (Attribute a : getAttributes()) {
+			if (a instanceof value) {
+				a.getAttrValue().setLITERAL(unfix(s));
+			}
+		}		
+	}
+
 	syn String ComplexElement.id() = "";
 	eq Instance.id() {
 		for (int i=0; i<getNumAttribute(); i++) {
@@ -186,6 +198,12 @@ aspect misc {
 		}
 		return s;
 	}
+	static String ASTNode.unfix(String s) {
+		if (s.indexOf('"') != 0) {
+			return "\""+s+"\"";
+		}
+		return s;
+	}
 }