Index: stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs
===================================================================
--- stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs	(revision 11149)
+++ stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs	(revision 11150)
@@ -47,4 +47,5 @@
     private void InitializeComponent() {
       this.components = new System.ComponentModel.Container();
+      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InteractiveSymbolicDataAnalysisSolutionSimplifierView));
       this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
       this.splitContainer = new System.Windows.Forms.SplitContainer();
@@ -52,9 +53,8 @@
       this.treeStatusValue = new System.Windows.Forms.Label();
       this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
+      this.btnSimplify = new System.Windows.Forms.Button();
       this.btnOptimizeConstants = new System.Windows.Forms.Button();
-      this.btnSimplify = new System.Windows.Forms.Button();
-      this.treeStatusLabel = new System.Windows.Forms.Label();
-      this.treeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
       this.grpViewHost = new System.Windows.Forms.GroupBox();
+      this.treeChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.InteractiveSymbolicExpressionTreeChart();
       ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
       this.splitContainer.Panel1.SuspendLayout();
@@ -104,5 +104,4 @@
       this.grpSimplify.Controls.Add(this.treeStatusValue);
       this.grpSimplify.Controls.Add(this.flowLayoutPanel);
-      this.grpSimplify.Controls.Add(this.treeStatusLabel);
       this.grpSimplify.Controls.Add(this.treeChart);
       this.grpSimplify.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -116,12 +115,14 @@
       // treeStatusValue
       // 
+      this.treeStatusValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
       this.treeStatusValue.AutoSize = true;
-      this.treeStatusValue.BackColor = System.Drawing.Color.Transparent;
-      this.treeStatusValue.ForeColor = System.Drawing.Color.Green;
-      this.treeStatusValue.Location = new System.Drawing.Point(72, 16);
+      this.treeStatusValue.BackColor = System.Drawing.Color.White;
+      this.treeStatusValue.ForeColor = System.Drawing.Color.Red;
+      this.treeStatusValue.Location = new System.Drawing.Point(6, 351);
       this.treeStatusValue.Name = "treeStatusValue";
-      this.treeStatusValue.Size = new System.Drawing.Size(30, 13);
+      this.treeStatusValue.Size = new System.Drawing.Size(63, 13);
       this.treeStatusValue.TabIndex = 3;
-      this.treeStatusValue.Text = "Valid";
+      this.treeStatusValue.Text = "Invalid Tree";
+      this.treeStatusValue.Visible = false;
       // 
       // flowLayoutPanel
@@ -137,26 +138,8 @@
       this.flowLayoutPanel.WrapContents = false;
       // 
-      // btnOptimizeConstants
-      //       
-      this.btnOptimizeConstants.AutoSize = true;
-      this.btnOptimizeConstants.Enabled = false;
-      this.btnOptimizeConstants.Image = HeuristicLab.Common.Resources.VSImageLibrary.Performance;
-      this.btnOptimizeConstants.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
-      this.btnOptimizeConstants.Location = new System.Drawing.Point(105, 3);
-      this.btnOptimizeConstants.Name = "btnOptimizeConstants";
-      this.btnOptimizeConstants.Size = new System.Drawing.Size(80, 24);
-      this.btnOptimizeConstants.TabIndex = 2;
-      this.btnOptimizeConstants.Text = "Optimize";
-      this.btnOptimizeConstants.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-      this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
-      this.btnOptimizeConstants.UseVisualStyleBackColor = true;
-      this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
-      // 
       // btnSimplify
       // 
       this.btnSimplify.AutoSize = true;
-      this.btnSimplify.Enabled = true;
       this.btnSimplify.Image = HeuristicLab.Common.Resources.VSImageLibrary.FormulaEvaluator;
-      this.btnSimplify.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
       this.btnSimplify.Location = new System.Drawing.Point(3, 3);
       this.btnSimplify.Name = "btnSimplify";
@@ -164,35 +147,21 @@
       this.btnSimplify.TabIndex = 1;
       this.btnSimplify.Text = "Simplify";
-      this.btnSimplify.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
       this.btnSimplify.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
       this.btnSimplify.UseVisualStyleBackColor = true;
       this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click);
       // 
-      // treeStatusLabel
-      // 
-      this.treeStatusLabel.AutoSize = true;
-      this.treeStatusLabel.BackColor = System.Drawing.Color.Transparent;
-      this.treeStatusLabel.Location = new System.Drawing.Point(6, 16);
-      this.treeStatusLabel.Name = "treeStatusLabel";
-      this.treeStatusLabel.Size = new System.Drawing.Size(68, 13);
-      this.treeStatusLabel.TabIndex = 2;
-      this.treeStatusLabel.Text = "Tree Status: ";
-      // 
-      // treeChart
-      // 
-      this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-            | System.Windows.Forms.AnchorStyles.Left)
-            | System.Windows.Forms.AnchorStyles.Right)));
-      this.treeChart.BackgroundColor = System.Drawing.Color.White;
-      this.treeChart.LineColor = System.Drawing.Color.Black;
-      this.treeChart.Location = new System.Drawing.Point(6, 32);
-      this.treeChart.Name = "treeChart";
-      this.treeChart.Size = new System.Drawing.Size(201, 332);
-      this.treeChart.Spacing = 5;
-      this.treeChart.SuspendRepaint = false;
-      this.treeChart.TabIndex = 0;
-      this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
-      this.treeChart.Tree = null;
-      this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);
+      // btnOptimizeConstants
+      // 
+      this.btnOptimizeConstants.AutoSize = true;
+      this.btnOptimizeConstants.Enabled = false;
+      this.btnOptimizeConstants.Image = HeuristicLab.Common.Resources.VSImageLibrary.Performance;
+      this.btnOptimizeConstants.Location = new System.Drawing.Point(89, 3);
+      this.btnOptimizeConstants.Name = "btnOptimizeConstants";
+      this.btnOptimizeConstants.Size = new System.Drawing.Size(80, 24);
+      this.btnOptimizeConstants.TabIndex = 2;
+      this.btnOptimizeConstants.Text = "Optimize";
+      this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
+      this.btnOptimizeConstants.UseVisualStyleBackColor = true;
+      this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
       // 
       // grpViewHost
@@ -206,4 +175,22 @@
       this.grpViewHost.TabStop = false;
       this.grpViewHost.Text = "Details";
+      // 
+      // treeChart
+      // 
+      this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+            | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.treeChart.BackgroundColor = System.Drawing.Color.White;
+      this.treeChart.LineColor = System.Drawing.Color.Black;
+      this.treeChart.Location = new System.Drawing.Point(6, 16);
+      this.treeChart.ModifyTree = null;
+      this.treeChart.Name = "treeChart";
+      this.treeChart.Size = new System.Drawing.Size(201, 348);
+      this.treeChart.Spacing = 5;
+      this.treeChart.SuspendRepaint = false;
+      this.treeChart.TabIndex = 0;
+      this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
+      this.treeChart.Tree = null;
+      this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);
       // 
       // InteractiveSymbolicDataAnalysisSolutionSimplifierView
@@ -223,4 +210,5 @@
       this.grpSimplify.PerformLayout();
       this.flowLayoutPanel.ResumeLayout(false);
+      this.flowLayoutPanel.PerformLayout();
       this.grpViewHost.ResumeLayout(false);
       this.ResumeLayout(false);
@@ -230,5 +218,5 @@
     #endregion
 
-    private HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart treeChart;
+    private HeuristicLab.Problems.DataAnalysis.Symbolic.Views.InteractiveSymbolicExpressionTreeChart treeChart;
     private System.Windows.Forms.SplitContainer splitContainer;
     private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
@@ -239,5 +227,4 @@
     protected System.Windows.Forms.Button btnOptimizeConstants;
     private System.Windows.Forms.Label treeStatusValue;
-    private System.Windows.Forms.Label treeStatusLabel;
   }
 }
Index: stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
===================================================================
--- stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 11149)
+++ stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 11150)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -33,12 +33,95 @@
   public abstract partial class InteractiveSymbolicDataAnalysisSolutionSimplifierView : AsynchronousContentView {
     private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> foldedNodes;
+    private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> changedNodes;
     private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts;
+
     private enum TreeState { Valid, Invalid }
-
-    public InteractiveSymbolicDataAnalysisSolutionSimplifierView() {
+    private TreeState treeState;
+
+    protected InteractiveSymbolicDataAnalysisSolutionSimplifierView() {
       InitializeComponent();
       foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
+      changedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
       nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>();
       this.Caption = "Interactive Solution Simplifier";
+
+      // initialize the tree modifier that will be used to perform edit operations over the tree
+      treeChart.ModifyTree = Modify;
+    }
+
+    /// <summary>
+    /// Remove, Replace or Insert subtrees
+    /// </summary>
+    /// <param name="tree">The symbolic expression tree</param>
+    /// <param name="parent">The insertion point (ie, the parent node who will receive a new child)</param>
+    /// <param name="oldChild">The subtree to be replaced</param>
+    /// <param name="newChild">The replacement subtree</param>
+    /// <param name="removeSubtree">Flag used to indicate if whole subtrees should be removed (default behavior), or just the subtree root</param>
+    private void Modify(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode parent,
+      ISymbolicExpressionTreeNode oldChild, ISymbolicExpressionTreeNode newChild, bool removeSubtree = true) {
+      if (oldChild == null && newChild == null)
+        throw new ArgumentNullException("Cannot deduce operation type from the arguments. Please provide non null operands.");
+      if (oldChild == null) {
+        // insertion operation
+        parent.AddSubtree(newChild);
+        newChild.Parent = parent;
+      } else if (newChild == null) {
+        // removal operation
+        parent.RemoveSubtree(parent.IndexOfSubtree(oldChild));
+        if (!removeSubtree) {
+          for (int i = oldChild.SubtreeCount - 1; i >= 0; --i) {
+            var subtree = oldChild.GetSubtree(i);
+            oldChild.RemoveSubtree(i);
+            parent.AddSubtree(subtree);
+          }
+        }
+      } else {
+        // replacement operation
+        var replacementIndex = parent.IndexOfSubtree(oldChild);
+        parent.RemoveSubtree(replacementIndex);
+        parent.InsertSubtree(replacementIndex, newChild);
+        newChild.Parent = parent;
+        if (changedNodes.ContainsKey(oldChild)) {
+          changedNodes.Add(newChild, changedNodes[oldChild]); // so that on double click the original node is restored
+          changedNodes.Remove(oldChild);
+        } else {
+          changedNodes.Add(newChild, oldChild);
+        }
+      }
+      treeState = IsValid(tree) ? TreeState.Valid : TreeState.Invalid;
+      switch (treeState) {
+        case TreeState.Valid:
+          this.grpViewHost.Enabled = true;
+          UpdateModel(Content.Model.SymbolicExpressionTree);
+          break;
+        case TreeState.Invalid:
+          this.grpViewHost.Enabled = false;
+          break;
+      }
+    }
+
+    // the optimizer always assumes 2 children for multiplication and addition nodes
+    // thus, we enforce that the tree stays valid so that the constant optimization won't throw an exception
+    // by returning 2 as the minimum allowed arity for addition and multiplication symbols
+    private readonly Func<ISymbol, int> GetMinArity = symbol => {
+      var min = symbol.MinimumArity;
+      if (symbol is Multiplication || symbol is Division) return Math.Max(2, min);
+      return min;
+    };
+    private bool IsValid(ISymbolicExpressionTree tree) {
+      treeChart.Tree = tree;
+      treeChart.Repaint();
+      bool valid = !tree.IterateNodesPostfix().Any(node => node.SubtreeCount < GetMinArity(node.Symbol) || node.SubtreeCount > node.Symbol.MaximumArity);
+      if (valid) {
+        btnOptimizeConstants.Enabled = true;
+        btnSimplify.Enabled = true;
+        treeStatusValue.Visible = false;
+      } else {
+        btnOptimizeConstants.Enabled = false;
+        btnSimplify.Enabled = false;
+        treeStatusValue.Visible = true;
+      }
+      this.Refresh();
+      return valid;
     }
 
@@ -83,9 +166,9 @@
 
       var impactAndReplacementValues = CalculateImpactAndReplacementValues(tree);
-      nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1);
       var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
       foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
         foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value);
       }
+      nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1);
       PaintNodeImpacts();
     }
@@ -104,12 +187,22 @@
 
     private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
+      if (treeState == TreeState.Invalid) return;
       var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender;
-      if (visualNode.Content == null) { throw new Exception("Visual node content cannot be null."); }
+      if (visualNode.Content == null) { throw new Exception("VisualNode content cannot be null."); }
       var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.Content;
-      if (!foldedNodes.ContainsKey(symbExprTreeNode)) return; // constant nodes cannot be folded
+      var tree = Content.Model.SymbolicExpressionTree;
       var parent = symbExprTreeNode.Parent;
       int indexOfSubtree = parent.IndexOfSubtree(symbExprTreeNode);
-      SwitchNodeWithReplacementNode(parent, indexOfSubtree);
-      UpdateModel(Content.Model.SymbolicExpressionTree);
+      if (changedNodes.ContainsKey(symbExprTreeNode)) {
+        // undo node change
+        parent.RemoveSubtree(indexOfSubtree);
+        var originalNode = changedNodes[symbExprTreeNode];
+        parent.InsertSubtree(indexOfSubtree, originalNode);
+        changedNodes.Remove(symbExprTreeNode);
+      } else if (foldedNodes.ContainsKey(symbExprTreeNode)) {
+        // undo node folding
+        SwitchNodeWithReplacementNode(parent, indexOfSubtree);
+      }
+      UpdateModel(tree);
     }
 
@@ -130,9 +223,9 @@
       double max = impacts.Max();
       double min = impacts.Min();
-      foreach (var treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
+      foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
         VisualTreeNode<ISymbolicExpressionTreeNode> visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
 
         if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) {
-          visualTree.ToolTip = visualTree.Content.ToString(); // to avoid duplicate tooltips
+          visualTree.ToolTip = visualTree.Content.ToString();
           double impact = nodeImpacts[treeNode];
 
@@ -156,5 +249,7 @@
         }
         if (visualTree != null)
-          if (treeNode is ConstantTreeNode && foldedNodes.ContainsKey(treeNode)) {
+          if (changedNodes.ContainsKey(treeNode)) {
+            visualTree.LineColor = Color.DodgerBlue;
+          } else if (treeNode is ConstantTreeNode && foldedNodes.ContainsKey(treeNode)) {
             visualTree.LineColor = Color.DarkOrange;
           }
Index: stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.Designer.cs
===================================================================
--- stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.Designer.cs	(revision 11149)
+++ stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.Designer.cs	(revision 11150)
@@ -56,4 +56,6 @@
       this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
       this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+      this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
       this.SuspendLayout();
       // 
@@ -61,5 +63,5 @@
       // 
       this.insertNodeToolStripMenuItem.Name = "insertNodeToolStripMenuItem";
-      this.insertNodeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+      this.insertNodeToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
       this.insertNodeToolStripMenuItem.Text = "Insert Node";
       this.insertNodeToolStripMenuItem.Click += new System.EventHandler(this.insertNodeToolStripMenuItem_Click);
@@ -68,5 +70,5 @@
       // 
       this.changeNodeToolStripMenuItem.Name = "changeNodeToolStripMenuItem";
-      this.changeNodeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+      this.changeNodeToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
       this.changeNodeToolStripMenuItem.Text = "Change Node";
       this.changeNodeToolStripMenuItem.Click += new System.EventHandler(this.changeNodeToolStripMenuItem_Click);
@@ -75,6 +77,6 @@
       // 
       this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
-      this.cutToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
-      this.cutToolStripMenuItem.Text = "Cut";
+      this.cutToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+      this.cutToolStripMenuItem.Text = "Cut Subtree";
       this.cutToolStripMenuItem.Click += new System.EventHandler(this.cutToolStripMenuItem_Click);
       // 
@@ -85,5 +87,5 @@
             this.removeSubtreeToolStripMenuItem});
       this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
-      this.removeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+      this.removeToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
       this.removeToolStripMenuItem.Text = "Remove";
       this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeSubtreeToolStripMenuItem_Click);
@@ -106,6 +108,6 @@
       // 
       this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
-      this.pasteToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
-      this.pasteToolStripMenuItem.Text = "Paste";
+      this.pasteToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+      this.pasteToolStripMenuItem.Text = "Paste Subtree";
       this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Clicked);
       // 
@@ -118,16 +120,28 @@
       // 
       this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
-      this.copyToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
-      this.copyToolStripMenuItem.Text = "Copy";
+      this.copyToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+      this.copyToolStripMenuItem.Text = "Copy Subtree";
       this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
+      // 
+      // toolStripSeparator1
+      // 
+      this.toolStripSeparator1.Name = "toolStripSeparator1";
+      this.toolStripSeparator1.Size = new System.Drawing.Size(162, 6);
+      // 
+      // toolStripSeparator2
+      // 
+      this.toolStripSeparator2.Name = "toolStripSeparator2";
+      this.toolStripSeparator2.Size = new System.Drawing.Size(162, 6);
       //
       // contextMenuStrip
       //
       this.contextMenuStrip.Opened += this.contextMenuStrip_Opened;
-      this.contextMenuStrip.Items.AddRange(new ToolStripItem[] { insertNodeToolStripMenuItem, 
+      this.contextMenuStrip.Items.AddRange(new ToolStripItem[] { toolStripSeparator1,
+                                                                 insertNodeToolStripMenuItem, 
+                                                                 removeToolStripMenuItem, 
                                                                  changeNodeToolStripMenuItem, 
+                                                                 toolStripSeparator2,
                                                                  copyToolStripMenuItem, 
                                                                  cutToolStripMenuItem, 
-                                                                 removeToolStripMenuItem, 
                                                                  pasteToolStripMenuItem });
       // 
@@ -139,5 +153,4 @@
       this.Name = "InteractiveSymbolicExpressionTreeChart";
       this.ResumeLayout(false);
-
     }
 
@@ -154,4 +167,6 @@
     private ToolStripSeparator toolStripSeparator;
     private ToolStripMenuItem copyToolStripMenuItem;
+    private ToolStripSeparator toolStripSeparator1;
+    private ToolStripSeparator toolStripSeparator2;
   }
 }
Index: stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs
===================================================================
--- stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs	(revision 11149)
+++ stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs	(revision 11150)
@@ -76,6 +76,6 @@
         pasteToolStripMenuItem.Visible = true;
         pasteToolStripMenuItem.Enabled = tempNode != null && insertNodeToolStripMenuItem.Enabled
-                                                          && !(lastOp == EditOp.CutSubtree
-                                                               && tempNode.IterateNodesBreadth().Contains(currSelected.Content));
+                                                          && !(lastOp == EditOp.CutSubtree && tempNode.IterateNodesBreadth().Contains(node))
+                                                          && node.SubtreeCount < node.Symbol.MaximumArity;
       }
     }
@@ -83,17 +83,5 @@
     protected override void OnSymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) {
       currSelected = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; ;
-      if (currSelected != null) {
-        currSelected.LineColor = Color.FromArgb(130, currSelected.LineColor);
-        RepaintNode(currSelected);
-      }
       base.OnSymbolicExpressionTreeNodeClicked(sender, e);
-    }
-
-    protected override void SymbolicExpressionTreeChart_MouseClick(object sender, MouseEventArgs e) {
-      if (currSelected != null) {
-        currSelected.LineColor = Color.FromArgb(255, currSelected.LineColor);
-        RepaintNode(currSelected);
-      }
-      base.SymbolicExpressionTreeChart_MouseClick(sender, e);
     }
 
@@ -108,5 +96,5 @@
 
       using (var dialog = new InsertNodeDialog()) {
-        dialog.SetAllowedSymbols(parent.Grammar.AllowedSymbols.Where(s => s.Enabled && s.InitialFrequency > 0.0 && !(s is ProgramRootSymbol || s is StartSymbol || s is Defun)));
+        dialog.SetAllowedSymbols(parent.Grammar.Symbols.Where(s => !(s is ProgramRootSymbol || s is StartSymbol || s is Defun || s is GroupSymbol))); // allow everything
         dialog.ShowDialog(this);
         if (dialog.DialogResult != DialogResult.OK) return;
@@ -172,9 +160,9 @@
         foreach (var subtree in tempNode.IterateNodesPostfix()) {
           var visualNode = GetVisualSymbolicExpressionTreeNode(subtree);
-          visualNode.LineColor = Color.FromArgb(255, visualNode.LineColor); // reset the alpha value to 255
-          visualNode.TextColor = Color.FromArgb(255, visualNode.TextColor);
+          visualNode.LineColor = Color.Black;
+          visualNode.TextColor = Color.Black;
           if (subtree.Parent != null) {
             var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(subtree.Parent, subtree);
-            visualLine.LineColor = Color.FromArgb(255, visualLine.LineColor);
+            visualLine.LineColor = Color.Black;
           }
         }
@@ -183,13 +171,13 @@
       foreach (var node in tempNode.IterateNodesPostfix()) {
         var visualNode = GetVisualSymbolicExpressionTreeNode(node);
-        visualNode.LineColor = Color.FromArgb(100, visualNode.LineColor);
-        visualNode.TextColor = Color.FromArgb(100, visualNode.TextColor);
+        visualNode.LineColor = Color.LightGray;
+        visualNode.TextColor = Color.LightGray;
         foreach (var subtree in node.Subtrees) {
           var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(node, subtree);
-          visualLine.LineColor = Color.FromArgb(100, visualLine.LineColor);
-        }
-      }
-      currSelected = null;
-      Repaint();
+          visualLine.LineColor = Color.LightGray;
+        }
+      }
+      currSelected = null;
+      RepaintNodes(); // no need to redo the layout and repaint everything since this operation does not change the tree
     }
     private void removeNodeToolStripMenuItem_Click(object sender, EventArgs e) {
Index: stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs
===================================================================
--- stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs	(revision 11149)
+++ stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs	(revision 11150)
@@ -67,5 +67,5 @@
       // oldValueTextBox
       // 
-      this.oldValueTextBox.Location = new System.Drawing.Point(123, 6);
+      this.oldValueTextBox.Location = new System.Drawing.Point(106, 6);
       this.oldValueTextBox.Name = "oldValueTextBox";
       this.oldValueTextBox.ReadOnly = true;
@@ -75,5 +75,5 @@
       // newValueTextBox
       // 
-      this.newValueTextBox.Location = new System.Drawing.Point(123, 42);
+      this.newValueTextBox.Location = new System.Drawing.Point(106, 32);
       this.newValueTextBox.Name = "newValueTextBox";
       this.newValueTextBox.Size = new System.Drawing.Size(131, 20);
@@ -86,5 +86,5 @@
       // 
       this.newValueLabel.AutoSize = true;
-      this.newValueLabel.Location = new System.Drawing.Point(12, 45);
+      this.newValueLabel.Location = new System.Drawing.Point(12, 35);
       this.newValueLabel.Name = "newValueLabel";
       this.newValueLabel.Size = new System.Drawing.Size(59, 13);
@@ -101,5 +101,5 @@
       // 
       this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
-      this.okButton.Location = new System.Drawing.Point(15, 79);
+      this.okButton.Location = new System.Drawing.Point(81, 66);
       this.okButton.Name = "okButton";
       this.okButton.Size = new System.Drawing.Size(75, 23);
@@ -113,5 +113,5 @@
       this.cancelButton.CausesValidation = false;
       this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-      this.cancelButton.Location = new System.Drawing.Point(179, 79);
+      this.cancelButton.Location = new System.Drawing.Point(162, 66);
       this.cancelButton.Name = "cancelButton";
       this.cancelButton.Size = new System.Drawing.Size(75, 23);
@@ -127,5 +127,5 @@
       this.AutoSize = true;
       this.CancelButton = this.cancelButton;
-      this.ClientSize = new System.Drawing.Size(269, 116);
+      this.ClientSize = new System.Drawing.Size(248, 101);
       this.ControlBox = false;
       this.Controls.Add(this.cancelButton);
Index: stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs
===================================================================
--- stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs	(revision 11149)
+++ stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs	(revision 11150)
@@ -63,5 +63,5 @@
       // 
       this.nodeSymbolLabel.AutoSize = true;
-      this.nodeSymbolLabel.Location = new System.Drawing.Point(13, 13);
+      this.nodeSymbolLabel.Location = new System.Drawing.Point(19, 13);
       this.nodeSymbolLabel.Name = "nodeSymbolLabel";
       this.nodeSymbolLabel.Size = new System.Drawing.Size(41, 13);
@@ -73,7 +73,7 @@
       this.allowedSymbolsCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
       this.allowedSymbolsCombo.FormattingEnabled = true;
-      this.allowedSymbolsCombo.Location = new System.Drawing.Point(120, 10);
+      this.allowedSymbolsCombo.Location = new System.Drawing.Point(101, 10);
       this.allowedSymbolsCombo.Name = "allowedSymbolsCombo";
-      this.allowedSymbolsCombo.Size = new System.Drawing.Size(108, 21);
+      this.allowedSymbolsCombo.Size = new System.Drawing.Size(127, 21);
       this.allowedSymbolsCombo.TabIndex = 1;
       this.allowedSymbolsCombo.SelectedIndexChanged += new System.EventHandler(this.allowedSymbolsCombo_SelectedIndexChanged);
@@ -83,5 +83,5 @@
       // 
       this.variableWeightLabel.AutoSize = true;
-      this.variableWeightLabel.Location = new System.Drawing.Point(13, 44);
+      this.variableWeightLabel.Location = new System.Drawing.Point(19, 40);
       this.variableWeightLabel.Name = "variableWeightLabel";
       this.variableWeightLabel.Size = new System.Drawing.Size(41, 13);
@@ -93,5 +93,5 @@
       // 
       this.variableNameLabel.AutoSize = true;
-      this.variableNameLabel.Location = new System.Drawing.Point(13, 74);
+      this.variableNameLabel.Location = new System.Drawing.Point(19, 66);
       this.variableNameLabel.Name = "variableNameLabel";
       this.variableNameLabel.Size = new System.Drawing.Size(35, 13);
@@ -104,7 +104,7 @@
       this.variableNamesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
       this.variableNamesCombo.FormattingEnabled = true;
-      this.variableNamesCombo.Location = new System.Drawing.Point(120, 71);
+      this.variableNamesCombo.Location = new System.Drawing.Point(101, 63);
       this.variableNamesCombo.Name = "variableNamesCombo";
-      this.variableNamesCombo.Size = new System.Drawing.Size(108, 21);
+      this.variableNamesCombo.Size = new System.Drawing.Size(127, 21);
       this.variableNamesCombo.TabIndex = 5;
       this.variableNamesCombo.Visible = false;
@@ -112,7 +112,7 @@
       // variableWeightTextBox
       // 
-      this.variableWeightTextBox.Location = new System.Drawing.Point(120, 41);
+      this.variableWeightTextBox.Location = new System.Drawing.Point(101, 37);
       this.variableWeightTextBox.Name = "variableWeightTextBox";
-      this.variableWeightTextBox.Size = new System.Drawing.Size(108, 20);
+      this.variableWeightTextBox.Size = new System.Drawing.Size(127, 20);
       this.variableWeightTextBox.TabIndex = 6;
       this.variableWeightTextBox.Text = "0.0";
@@ -122,7 +122,7 @@
       // constantValueTextBox
       // 
-      this.constantValueTextBox.Location = new System.Drawing.Point(120, 41);
+      this.constantValueTextBox.Location = new System.Drawing.Point(101, 37);
       this.constantValueTextBox.Name = "constantValueTextBox";
-      this.constantValueTextBox.Size = new System.Drawing.Size(108, 20);
+      this.constantValueTextBox.Size = new System.Drawing.Size(127, 20);
       this.constantValueTextBox.TabIndex = 7;
       this.constantValueTextBox.Text = "0.0";
@@ -133,5 +133,5 @@
       // 
       this.constantValueLabel.AutoSize = true;
-      this.constantValueLabel.Location = new System.Drawing.Point(13, 44);
+      this.constantValueLabel.Location = new System.Drawing.Point(19, 40);
       this.constantValueLabel.Name = "constantValueLabel";
       this.constantValueLabel.Size = new System.Drawing.Size(34, 13);
@@ -149,5 +149,5 @@
       // 
       this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
-      this.okButton.Location = new System.Drawing.Point(12, 112);
+      this.okButton.Location = new System.Drawing.Point(72, 98);
       this.okButton.Name = "okButton";
       this.okButton.Size = new System.Drawing.Size(75, 23);
@@ -160,5 +160,5 @@
       // 
       this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-      this.cancelButton.Location = new System.Drawing.Point(153, 112);
+      this.cancelButton.Location = new System.Drawing.Point(153, 98);
       this.cancelButton.Name = "cancelButton";
       this.cancelButton.Size = new System.Drawing.Size(75, 23);
@@ -173,5 +173,5 @@
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.CancelButton = this.cancelButton;
-      this.ClientSize = new System.Drawing.Size(240, 147);
+      this.ClientSize = new System.Drawing.Size(241, 133);
       this.ControlBox = false;
       this.Controls.Add(this.cancelButton);
Index: stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.Designer.cs
===================================================================
--- stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.Designer.cs	(revision 11149)
+++ stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.Designer.cs	(revision 11150)
@@ -61,5 +61,5 @@
       // 
       this.originalValueLabel.AutoSize = true;
-      this.originalValueLabel.Location = new System.Drawing.Point(12, 48);
+      this.originalValueLabel.Location = new System.Drawing.Point(6, 42);
       this.originalValueLabel.Name = "originalValueLabel";
       this.originalValueLabel.Size = new System.Drawing.Size(72, 13);
@@ -69,5 +69,5 @@
       // oldValueTextBox
       // 
-      this.oldValueTextBox.Location = new System.Drawing.Point(123, 45);
+      this.oldValueTextBox.Location = new System.Drawing.Point(101, 39);
       this.oldValueTextBox.Name = "oldValueTextBox";
       this.oldValueTextBox.ReadOnly = true;
@@ -77,5 +77,5 @@
       // newValueTextBox
       // 
-      this.newValueTextBox.Location = new System.Drawing.Point(123, 82);
+      this.newValueTextBox.Location = new System.Drawing.Point(101, 65);
       this.newValueTextBox.Name = "newValueTextBox";
       this.newValueTextBox.Size = new System.Drawing.Size(131, 20);
@@ -88,5 +88,5 @@
       // 
       this.newValueLabel.AutoSize = true;
-      this.newValueLabel.Location = new System.Drawing.Point(12, 85);
+      this.newValueLabel.Location = new System.Drawing.Point(6, 68);
       this.newValueLabel.Name = "newValueLabel";
       this.newValueLabel.Size = new System.Drawing.Size(59, 13);
@@ -103,5 +103,5 @@
       // 
       this.variableNameLabel.AutoSize = true;
-      this.variableNameLabel.Location = new System.Drawing.Point(12, 12);
+      this.variableNameLabel.Location = new System.Drawing.Point(6, 15);
       this.variableNameLabel.Name = "variableNameLabel";
       this.variableNameLabel.Size = new System.Drawing.Size(76, 13);
@@ -114,5 +114,5 @@
       this.variableNamesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
       this.variableNamesCombo.FormattingEnabled = true;
-      this.variableNamesCombo.Location = new System.Drawing.Point(123, 9);
+      this.variableNamesCombo.Location = new System.Drawing.Point(101, 12);
       this.variableNamesCombo.Name = "variableNamesCombo";
       this.variableNamesCombo.Size = new System.Drawing.Size(131, 21);
@@ -126,5 +126,5 @@
       // 
       this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
-      this.okButton.Location = new System.Drawing.Point(15, 119);
+      this.okButton.Location = new System.Drawing.Point(75, 98);
       this.okButton.Name = "okButton";
       this.okButton.Size = new System.Drawing.Size(75, 23);
@@ -138,5 +138,5 @@
       this.cancelButton.CausesValidation = false;
       this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-      this.cancelButton.Location = new System.Drawing.Point(179, 119);
+      this.cancelButton.Location = new System.Drawing.Point(156, 98);
       this.cancelButton.Name = "cancelButton";
       this.cancelButton.Size = new System.Drawing.Size(75, 23);
@@ -152,5 +152,5 @@
       this.AutoSize = true;
       this.CancelButton = this.cancelButton;
-      this.ClientSize = new System.Drawing.Size(269, 154);
+      this.ClientSize = new System.Drawing.Size(244, 134);
       this.ControlBox = false;
       this.Controls.Add(this.cancelButton);
