Index: branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Formatters/SymbolicExpressionTreeLatexFormatter.cs
===================================================================
--- branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Formatters/SymbolicExpressionTreeLatexFormatter.cs	(revision 10468)
+++ branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Formatters/SymbolicExpressionTreeLatexFormatter.cs	(revision 10471)
@@ -53,8 +53,8 @@
 
     public string Format(ISymbolicExpressionTree symbolicExpressionTree) {
+      layoutEngine.Reset();
       var layoutNodes = layoutAdapter.Convert(symbolicExpressionTree).ToList();
       layoutEngine.Root = layoutNodes[0];
-      foreach (var ln in layoutNodes)
-        layoutEngine.AddNode(ln.Content, ln);
+      layoutEngine.AddNodes(layoutNodes);
       layoutEngine.CalculateLayout();
       var nodeCoordinates = layoutEngine.GetNodeCoordinates();
Index: branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj
===================================================================
--- branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj	(revision 10468)
+++ branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj	(revision 10471)
@@ -185,5 +185,4 @@
     <Compile Include="Formatters\SymbolicExpressionTreeLatexFormatter.cs" />
     <Compile Include="Interfaces\ILayoutAdapter.cs" />
-    <Compile Include="Interfaces\ILayoutNode.cs" />
     <Compile Include="Interfaces\IReadOnlySymbol.cs" />
     <Compile Include="Interfaces\ISymbolicExpressionGrammar.cs" />
Index: branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/ILayoutAdapter.cs
===================================================================
--- branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/ILayoutAdapter.cs	(revision 10468)
+++ branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/ILayoutAdapter.cs	(revision 10471)
@@ -4,5 +4,5 @@
 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
   public interface ILayoutAdapter<T> where T : class {
-    IEnumerable<ILayoutNode<T>> Convert(T root, Func<T, ILayoutNode<T>> convertFunc);
+    IEnumerable<LayoutNode<T>> Convert(T root, Func<T, LayoutNode<T>> convertFunc);
   }
 }
Index: branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/LayoutNode.cs
===================================================================
--- branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/LayoutNode.cs	(revision 10468)
+++ branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/LayoutNode.cs	(revision 10471)
@@ -20,20 +20,21 @@
 #endregion
 
+using System;
 using System.Collections.Generic;
 using System.Linq;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.LayoutEngines {
-  public class LayoutNode<T> : ILayoutNode<T> where T : class {
-    public ILayoutNode<T> NextLeft {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  public class LayoutNode<T> where T : class {
+    public LayoutNode<T> NextLeft {
       get {
         return Children == null ? Thread : Children.First();
       }
     }
-    public ILayoutNode<T> NextRight {
+    public LayoutNode<T> NextRight {
       get {
         return Children == null ? Thread : Children.Last();
       }
     }
-    public ILayoutNode<T> LeftSibling {
+    public LayoutNode<T> LeftSibling {
       get {
         if (Parent == null) return null;
@@ -41,5 +42,5 @@
       }
     }
-    public ILayoutNode<T> LeftmostSibling {
+    public LayoutNode<T> LeftmostSibling {
       get {
         if (Parent == null) return null;
@@ -48,8 +49,8 @@
     }
 
-    public ILayoutNode<T> Thread { get; set; }
-    public ILayoutNode<T> Ancestor { get; set; }
-    public ILayoutNode<T> Parent { get; set; }
-    public List<ILayoutNode<T>> Children { get; set; }
+    public LayoutNode<T> Thread { get; set; }
+    public LayoutNode<T> Ancestor { get; set; }
+    public LayoutNode<T> Parent { get; set; }
+    public List<LayoutNode<T>> Children { get; set; }
     public float Mod { get; set; }
     public float Prelim { get; set; }
@@ -65,5 +66,13 @@
     }
 
-    public T Content { get; set; }
+    private T content;
+    public T Content {
+      get { return content; }
+      set {
+        if (value == null)
+          throw new ArgumentNullException("LayoutNode: Content cannot be null.");
+        content = value;
+      }
+    }
   }
 }
Index: branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/ReingoldTilfordLayoutEngine.cs
===================================================================
--- branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/ReingoldTilfordLayoutEngine.cs	(revision 10468)
+++ branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/ReingoldTilfordLayoutEngine.cs	(revision 10471)
@@ -7,23 +7,37 @@
 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
   public class ReingoldTilfordLayoutEngine<T> where T : class {
-    private readonly Dictionary<T, ILayoutNode<T>> nodes; // provides a reverse mapping T => ILayoutNode
+    private readonly Dictionary<T, LayoutNode<T>> nodeMap; // provides a reverse mapping T => LayoutNode
 
     public ReingoldTilfordLayoutEngine() {
-      nodes = new Dictionary<T, ILayoutNode<T>>();
-    }
-
-    public Dictionary<T, ILayoutNode<T>> Nodes { get { return nodes; } }
-
-    public void AddNode(T content, ILayoutNode<T> node) {
-      if (nodes.ContainsKey(content)) {
+      nodeMap = new Dictionary<T, LayoutNode<T>>();
+    }
+
+    public Dictionary<T, LayoutNode<T>> NodeMap { get { return nodeMap; } }
+
+    public void AddNode(T content) {
+      if (nodeMap.ContainsKey(content)) {
         throw new ArgumentException("Content already present in the dictionary.");
       }
-      nodes.Add(content, node);
-    }
-
-    public ILayoutNode<T> GetNode(T content) {
-      ILayoutNode<T> ILayoutNode;
-      nodes.TryGetValue(content, out ILayoutNode);
-      return ILayoutNode;
+      var node = new LayoutNode<T> { Content = content };
+      nodeMap.Add(content, node);
+    }
+
+    public void AddNode(LayoutNode<T> node) {
+      var content = node.Content;
+      if (nodeMap.ContainsKey(content)) {
+        throw new ArgumentException("Content already present in the dictionary.");
+      }
+      nodeMap.Add(content, node);
+    }
+
+    public void AddNodes(IEnumerable<LayoutNode<T>> nodes) {
+      foreach (var node in nodes)
+        nodeMap.Add(node.Content, node);
+    }
+
+    public LayoutNode<T> GetNode(T content) {
+      LayoutNode<T> layoutNode;
+      nodeMap.TryGetValue(content, out layoutNode);
+      return layoutNode;
     }
 
@@ -40,6 +54,6 @@
     }
 
-    private ILayoutNode<T> root;
-    public ILayoutNode<T> Root {
+    private LayoutNode<T> root;
+    public LayoutNode<T> Root {
       get { return root; }
       set {
@@ -49,5 +63,5 @@
 
     public void ResetCoordinates() {
-      foreach (var node in nodes.Values) {
+      foreach (var node in nodeMap.Values) {
         node.X = 0;
         node.Y = 0;
@@ -56,14 +70,14 @@
 
     /// <summary>
-    /// Transform ILayoutNode coordinates so that all coordinates are positive and start from 0.
+    /// Transform LayoutNode coordinates so that all coordinates are positive and start from 0.
     /// </summary>
     private void NormalizeCoordinates() {
-      var list = nodes.Values.ToList();
+      var list = nodeMap.Values.ToList();
       float xmin = 0, ymin = 0;
-      for (int i = 0; i != list.Count; ++i) {
+      for (int i = 0; i < list.Count; ++i) {
         if (xmin > list[i].X) xmin = list[i].X;
         if (ymin > list[i].Y) ymin = list[i].Y;
       }
-      for (int i = 0; i != list.Count; ++i) {
+      for (int i = 0; i < list.Count; ++i) {
         list[i].X -= xmin;
         list[i].Y -= ymin;
@@ -73,9 +87,9 @@
     public void Reset() {
       root = null;
-      nodes.Clear();
+      nodeMap.Clear();
     }
 
     public void ResetParameters() {
-      foreach (var layoutNode in nodes.Values) {
+      foreach (var layoutNode in nodeMap.Values) {
         // reset layout-related parameters 
         layoutNode.Ancestor = layoutNode;
@@ -99,9 +113,9 @@
 
     /// <summary>
-    /// Returns a map of coordinates for each ILayoutNode in the symbolic expression tree.
+    /// Returns a map of coordinates for each LayoutNode in the symbolic expression tree.
     /// </summary>
     /// <returns></returns>
     public Dictionary<T, PointF> GetNodeCoordinates() {
-      return nodes.ToDictionary(x => x.Key, x => new PointF(x.Value.X, x.Value.Y));
+      return nodeMap.ToDictionary(x => x.Key, x => new PointF(x.Value.X, x.Value.Y));
     }
 
@@ -112,6 +126,6 @@
     public RectangleF Bounds() {
       float xmin, xmax, ymin, ymax; xmin = xmax = ymin = ymax = 0;
-      var list = nodes.Values.ToList();
-      for (int i = 0; i != list.Count; ++i) {
+      var list = nodeMap.Values.ToList();
+      for (int i = 0; i < list.Count; ++i) {
         float x = list[i].X, y = list[i].Y;
         if (xmin > x) xmin = x;
@@ -123,6 +137,6 @@
     }
 
-    private void FirstWalk(ILayoutNode<T> v) {
-      ILayoutNode<T> w;
+    private void FirstWalk(LayoutNode<T> v) {
+      LayoutNode<T> w;
       if (v.IsLeaf) {
         w = v.LeftSibling;
@@ -151,5 +165,5 @@
     }
 
-    private void SecondWalk(ILayoutNode<T> v, float m) {
+    private void SecondWalk(LayoutNode<T> v, float m) {
       v.X = v.Prelim + m;
       v.Y = v.Level * minVerticalSpacing;
@@ -160,11 +174,11 @@
     }
 
-    private void Apportion(ILayoutNode<T> v, ref ILayoutNode<T> defaultAncestor) {
+    private void Apportion(LayoutNode<T> v, ref LayoutNode<T> defaultAncestor) {
       var w = v.LeftSibling;
       if (w == null) return;
-      ILayoutNode<T> vip = v;
-      ILayoutNode<T> vop = v;
-      ILayoutNode<T> vim = w;
-      ILayoutNode<T> vom = vip.LeftmostSibling;
+      LayoutNode<T> vip = v;
+      LayoutNode<T> vop = v;
+      LayoutNode<T> vim = w;
+      LayoutNode<T> vom = vip.LeftmostSibling;
 
       float sip = vip.Mod;
@@ -202,7 +216,7 @@
     }
 
-    private void MoveSubtree(ILayoutNode<T> wm, ILayoutNode<T> wp, float shift) {
-      int subtrees = wp.Number - wm.Number; // TODO: Investigate possible bug (if the value ever happens to be zero) - happens when the tree is actually a graph
-      if (subtrees == 0) throw new Exception();
+    private void MoveSubtree(LayoutNode<T> wm, LayoutNode<T> wp, float shift) {
+      int subtrees = wp.Number - wm.Number; // TODO: Investigate possible bug (if the value ever happens to be zero) - happens when the tree is actually a graph (but that's outside the use case of this algorithm which only works with trees)
+      if (subtrees == 0) throw new Exception("MoveSubtree failed: check if object is really a tree (no cycles)");
       wp.Change -= shift / subtrees;
       wp.Shift += shift;
@@ -212,5 +226,5 @@
     }
 
-    private void ExecuteShifts(ILayoutNode<T> v) {
+    private void ExecuteShifts(LayoutNode<T> v) {
       if (v.IsLeaf) return;
       float shift = 0;
@@ -225,5 +239,5 @@
     }
 
-    private ILayoutNode<T> Ancestor(ILayoutNode<T> u, ILayoutNode<T> v) {
+    private LayoutNode<T> Ancestor(LayoutNode<T> u, LayoutNode<T> v) {
       var ancestor = u.Ancestor;
       if (ancestor == null) return null;
Index: branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/SymbolicExpressionTreeLayoutAdapter.cs
===================================================================
--- branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/SymbolicExpressionTreeLayoutAdapter.cs	(revision 10468)
+++ branches/HeuristicLab.ReingoldTilfordTreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/SymbolicExpressionTreeLayoutAdapter.cs	(revision 10471)
@@ -22,11 +22,10 @@
 using System;
 using System.Collections.Generic;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.LayoutEngines;
 
 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
   // adapter class that provides some conversion methods from symbolic expression trees to layout nodes (preserving the tree structure)
   public class SymbolicExpressionTreeLayoutAdapter : ILayoutAdapter<ISymbolicExpressionTreeNode> {
-    // default conversion function between ISymbolicExpressionTreeNode and ILayoutNode<ISymbolicExpressionTree>
-    ILayoutNode<ISymbolicExpressionTreeNode> defaultConvert(ISymbolicExpressionTreeNode node) {
+    // default conversion function between ISymbolicExpressionTreeNode and LayoutNode<ISymbolicExpressionTree>
+    LayoutNode<ISymbolicExpressionTreeNode> defaultConvert(ISymbolicExpressionTreeNode node) {
       var layoutNode = new LayoutNode<ISymbolicExpressionTreeNode> { Content = node };
       layoutNode.Ancestor = layoutNode;
@@ -34,24 +33,25 @@
     }
 
-    public IEnumerable<ILayoutNode<ISymbolicExpressionTreeNode>> Convert(ISymbolicExpressionTree tree, Func<ISymbolicExpressionTreeNode, ILayoutNode<ISymbolicExpressionTreeNode>> convertFunc = null) {
+    public IEnumerable<LayoutNode<ISymbolicExpressionTreeNode>> Convert(ISymbolicExpressionTree tree, Func<ISymbolicExpressionTreeNode, LayoutNode<ISymbolicExpressionTreeNode>> convertFunc = null) {
       return Convert(tree.Root, convertFunc);
     }
     // translate the symbolic expression tree structure to a layout node tree structure
     // return an enumerable containing all the layout nodes
-    public IEnumerable<ILayoutNode<ISymbolicExpressionTreeNode>> Convert(ISymbolicExpressionTreeNode root, Func<ISymbolicExpressionTreeNode, ILayoutNode<ISymbolicExpressionTreeNode>> convertFunc = null) {
+    public IEnumerable<LayoutNode<ISymbolicExpressionTreeNode>> Convert(ISymbolicExpressionTreeNode root, Func<ISymbolicExpressionTreeNode, LayoutNode<ISymbolicExpressionTreeNode>> convertFunc = null) {
       var rootLayoutNode = convertFunc == null ? defaultConvert(root) : convertFunc(root);
       rootLayoutNode.Ancestor = rootLayoutNode;
 
       if (root.SubtreeCount > 0) {
-        rootLayoutNode.Children = new List<ILayoutNode<ISymbolicExpressionTreeNode>>(root.SubtreeCount);
+        rootLayoutNode.Children = new List<LayoutNode<ISymbolicExpressionTreeNode>>(root.SubtreeCount);
         Expand(rootLayoutNode, convertFunc);
       }
 
-      var list = new List<ILayoutNode<ISymbolicExpressionTreeNode>> { rootLayoutNode };
+      var list = new List<LayoutNode<ISymbolicExpressionTreeNode>> { rootLayoutNode };
       int i = 0;
       while (i < list.Count) {
         if (list[i].Children != null)
-          foreach (ILayoutNode<ISymbolicExpressionTreeNode> child in list[i].Children)
-            list.Add(child);
+          list.AddRange(list[i].Children);
+        //          foreach (LayoutNode<ISymbolicExpressionTreeNode> child in list[i].Children)
+        //            list.Add(child);
         ++i;
       }
@@ -59,5 +59,5 @@
     }
 
-    private void Expand(ILayoutNode<ISymbolicExpressionTreeNode> layoutNode, Func<ISymbolicExpressionTreeNode, ILayoutNode<ISymbolicExpressionTreeNode>> convertFunc = null) {
+    private void Expand(LayoutNode<ISymbolicExpressionTreeNode> layoutNode, Func<ISymbolicExpressionTreeNode, LayoutNode<ISymbolicExpressionTreeNode>> convertFunc = null) {
       if (layoutNode.Children == null) return;
       for (int i = 0; i < layoutNode.Content.SubtreeCount; ++i) {
@@ -68,5 +68,5 @@
         childLayoutNode.Level = layoutNode.Level + 1;
         childLayoutNode.Ancestor = childLayoutNode;
-        childLayoutNode.Children = subtree.SubtreeCount > 0 ? new List<ILayoutNode<ISymbolicExpressionTreeNode>>(subtree.SubtreeCount) : null;
+        childLayoutNode.Children = subtree.SubtreeCount > 0 ? new List<LayoutNode<ISymbolicExpressionTreeNode>>(subtree.SubtreeCount) : null;
         layoutNode.Children.Add(childLayoutNode);
         Expand(childLayoutNode, convertFunc);
