Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs	(revision 9963)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs	(revision 9996)
@@ -35,6 +35,11 @@
     private Dictionary<ISymbolicExpressionTreeNode, VisualSymbolicExpressionTreeNode> visualTreeNodes;
     private Dictionary<Tuple<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>, VisualSymbolicExpressionTreeNodeConnection> visualLines;
-    private readonly ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> layoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> { MinHorizontalSpacing = 5, MinVerticalSpacing = 5 };
-    private readonly SymbolicExpressionTreeLayoutAdapter layoutAdapter = new SymbolicExpressionTreeLayoutAdapter();
+    private readonly ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> layoutEngine;
+    private readonly SymbolicExpressionTreeLayoutAdapter layoutAdapter;
+
+    private const int preferredNodeWidth = 70;
+    private const int preferredNodeHeight = 46;
+    private const int minHorizontalDistance = 20;
+    private const int minVerticalDistance = 20;
 
 
@@ -46,9 +51,13 @@
       this.lineColor = Color.Black;
       this.backgroundColor = Color.White;
-      this.textFont = new Font("Times New Roman", 8);
+      this.textFont = new Font("Times New Roman", 12);
+      layoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>();
+      layoutAdapter = new SymbolicExpressionTreeLayoutAdapter();
     }
 
     public SymbolicExpressionTreeChart(ISymbolicExpressionTree tree)
       : this() {
+      layoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>();
+      layoutAdapter = new SymbolicExpressionTreeLayoutAdapter();
       this.Tree = tree;
     }
@@ -165,5 +174,5 @@
         graphics.Clear(backgroundColor);
         if (tree != null) {
-          DrawFunctionTree(tree, graphics, 70, 46, 20, 50);
+          DrawFunctionTree(tree, graphics, preferredNodeWidth, preferredNodeHeight, minHorizontalDistance, minVerticalDistance);
         }
       }
@@ -258,5 +267,5 @@
     #region methods for painting the symbolic expression tree
 
-    private void DrawFunctionTree(ISymbolicExpressionTree tree, Graphics graphics, int preferredWidth, int preferredHeight, int minDistance, int maxDistance) {
+    private void DrawFunctionTree(ISymbolicExpressionTree tree, Graphics graphics, int preferredWidth, int preferredHeight, int minHDistance, int minVDistance) {
       var layoutNodes = layoutAdapter.Convert(tree).ToList();
       layoutEngine.Reset();
@@ -264,37 +273,40 @@
       foreach (var ln in layoutNodes)
         layoutEngine.AddNode(ln.Content, ln);
+      layoutEngine.MinHorizontalSpacing = (preferredNodeWidth + minHDistance);
+      layoutEngine.MinVerticalSpacing = (preferredNodeHeight + minVDistance);
       layoutEngine.CalculateLayout();
-      var nodePositions = layoutEngine.GetNodeCoordinates();
       var bounds = layoutEngine.Bounds();
-
-      double sx = Width / bounds.Width;
-      double sy = Height / bounds.Height;
-
-      double dx = layoutEngine.MinHorizontalSpacing * sx; // scaled horizontal distance
-      double dy = layoutEngine.MinVerticalSpacing * sy; // scaled vertical distance
-
-      int maxWidth = (int)Math.Round(dx);
-      int maxHeight = (int)Math.Round(dy);
-
-      // instead of using the preferred with/height of each node inside the foreach loop below,
-      // we assume the same width/height for all nodes
-      int w = Math.Min(preferredWidth, maxWidth - minDistance / 2);
-      int h = Math.Min(preferredHeight, maxHeight - minDistance / 2);
-      // adjust scaling factor so that nodes will be at most maxDistance far from each other on the horizontal axis
-      double offset = 0;
-      if (maxDistance + w < maxWidth) {
-        sx *= (double)(maxDistance + w) / maxWidth;
-        offset = (Width - (sx * bounds.Width)) / 2;
-      }
-      foreach (var node in visualTreeNodes.Keys) {
-        var visualNode = visualTreeNodes[node];
-        var pos = nodePositions[node];
-        visualNode.Width = w;
-        visualNode.Height = h;
-        visualNode.X = (int)Math.Round(pos.X * sx + offset); ;
-        visualNode.Y = (int)Math.Round(pos.Y * sy);
-        DrawTreeNode(graphics, visualNode);
-      }
+      double sx = this.Width / (bounds.Width + preferredWidth);
+      if (sx > 1) sx = 1;
+      double sy = this.Height / bounds.Height;
+      if (sy > 1) sy = 1;
+      double dx = (this.Width - bounds.Width) / 2;
+      if (dx < 0) dx = 0;
+      double dy = (this.Height - bounds.Height) / 2;
+      if (dy < 0) dy = 0;
+
+      var levels = layoutNodes.GroupBy(n => n.Level, n => n);
+
+      foreach (var level in levels) {
+        var nodes = level.ToList();
+        double min = 0;
+        for (int i = 0; i < nodes.Count - 1; ++i) {
+          var w = (nodes[i + 1].X - nodes[i].X) * sx - preferredWidth;
+          if (w < min) min = w;
+        }
+        if (min > 0) min = 0;
+
+        foreach (var layoutNode in level) {
+          var visualNode = visualTreeNodes[layoutNode.Content];
+          visualNode.Width = (int)Math.Round(preferredWidth + min) - 2; // -2 to allow enough padding (1px on each side) for the node contour to be drawn
+          visualNode.Height = (int)Math.Round(preferredHeight * sy);
+          visualNode.X = (int)(Math.Round(layoutNode.X * sx + dx));
+          visualNode.Y = (int)(Math.Round(layoutNode.Y * sy + dy));
+          DrawTreeNode(graphics, visualNode);
+        }
+      }
+
       graphics.ResetClip(); // reset clip region
+      // draw node connections
       foreach (var visualNode in visualTreeNodes.Values) {
         var node = visualNode.SymbolicExpressionTreeNode;
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Fragment.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Fragment.cs	(revision 9963)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Fragment.cs	(revision 9996)
@@ -56,4 +56,5 @@
       Length = original.Length;
       Index = original.Index;
+      OldIndex = original.OldIndex;
     }
 
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/GeneticExchange.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/GeneticExchange.cs	(revision 9963)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/GeneticExchange.cs	(revision 9996)
@@ -28,10 +28,25 @@
   [StorableClass]
   public class GeneticExchange : Item {
-    public IFragment FragmentIn { get; set; }
-    public IFragment FragmentOut { get; set; }
+    [Storable]
+    private IFragment inFragment;
+    public IFragment FragmentIn {
+      get { return inFragment; }
+      set { inFragment = value; }
+    }
+    [Storable]
+    private IFragment outFragment;
+    public IFragment FragmentOut {
+      get { return outFragment; }
+      set { outFragment = value; }
+    }
 
     [StorableConstructor]
     private GeneticExchange(bool serializing) : base(serializing) { }
-    private GeneticExchange(GeneticExchange original, Cloner cloner) : base(original, cloner) { }
+
+    private GeneticExchange(GeneticExchange original, Cloner cloner)
+      : base(original, cloner) {
+      inFragment = (IFragment)original.inFragment.Clone();
+      outFragment = (IFragment)original.outFragment.Clone();
+    }
     public GeneticExchange() { }
 
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/ReingoldTilfordLayoutEngine.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/ReingoldTilfordLayoutEngine.cs	(revision 9963)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/LayoutEngines/ReingoldTilfordLayoutEngine.cs	(revision 9996)
@@ -46,13 +46,4 @@
         root = value;
       }
-    }
-
-    /// <summary>
-    /// Returns a string containing all the coordinates (useful for debugging).
-    /// </summary>
-    /// <returns></returns>
-    public string DumpCoordinates() {
-      if (nodes == null || nodes.Count == 0) return string.Empty;
-      return nodes.Values.Aggregate("", (current, node) => current + (node.X + " " + node.Y + Environment.NewLine));
     }
 
@@ -161,5 +152,4 @@
 
     private void SecondWalk(ILayoutNode<T> v, float m) {
-      if (!nodes.Values.Contains(v)) throw new Exception("Layout node not present in dictionary!");
       v.X = v.Prelim + m;
       v.Y = v.Level * minVerticalSpacing;
