Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/AllArchitectureAlteringOperatorsTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/AllArchitectureAlteringOperatorsTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/AllArchitectureAlteringOperatorsTest.cs	(revision 5549)
@@ -25,17 +25,14 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Crossovers;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class AllArchitectureAlteringOperatorsTest {
     private const int POPULATION_SIZE = 1000;
     private const int N_ITERATIONS = 20;
-    private const int MAX_TREE_SIZE = 100;
-    private const int MAX_TREE_HEIGHT = 10;
+    private const int MAX_TREE_LENGTH = 100;
+    private const int MAX_TREE_DEPTH = 10;
     private TestContext testContextInstance;
 
@@ -55,14 +52,14 @@
     [TestMethod()]
     public void AllArchitectureAlteringOperatorsDistributionTest() {
-      var trees = new List<SymbolicExpressionTree>();
-      var newTrees = new List<SymbolicExpressionTree>();
+      var trees = new List<ISymbolicExpressionTree>();
+      var newTrees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister(31415);
-      IntValue maxTreeSize = new IntValue(MAX_TREE_SIZE);
-      IntValue maxTreeHeigth = new IntValue(MAX_TREE_HEIGHT);
+      IntValue maxTreeSize = new IntValue(MAX_TREE_LENGTH);
+      IntValue maxTreeHeigth = new IntValue(MAX_TREE_DEPTH);
       IntValue maxDefuns = new IntValue(3);
       IntValue maxArgs = new IntValue(3);
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
         Util.IsValid(tree);
         trees.Add(tree);
@@ -70,5 +67,4 @@
       Stopwatch stopwatch = new Stopwatch();
       stopwatch.Start();
-      var combinedAAOperator = new MultiSymbolicExpressionTreeArchitectureManipulator();
       int failedEvents = 0;
       for (int g = 0; g < N_ITERATIONS; g++) {
@@ -76,9 +72,15 @@
           if (random.NextDouble() < 0.5) {
             // manipulate
-            var selectedTree = (SymbolicExpressionTree)trees.SelectRandom(random).Clone();
-            var op = combinedAAOperator.Operators.SelectRandom(random);
+            var selectedTree = (ISymbolicExpressionTree)trees.SelectRandom(random).Clone();
             bool success = false;
-            op.ModifyArchitecture(random, selectedTree, grammar, maxTreeSize, maxTreeHeigth, maxDefuns, maxArgs, out success);
-            if (!success) failedEvents++; // architecture manipulation might fail
+            switch (random.Next(6)) {
+              case 0: success = ArgumentCreater.CreateNewArgument(random, selectedTree, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3); break;
+              case 1: success = ArgumentDeleter.DeleteArgument(random, selectedTree, 3, 3); break;
+              case 2: success = ArgumentDuplicater.DuplicateArgument(random, selectedTree, 3, 3); break;
+              case 3: success = SubroutineCreater.CreateSubroutine(random, selectedTree, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3); break;
+              case 4: success = SubroutineDuplicater.DuplicateSubroutine(random, selectedTree, 3, 3); break;
+              case 5: success = SubroutineDeleter.DeleteSubroutine(random, selectedTree, 3, 3); break;
+            }
+            if (!success) failedEvents++;
             Util.IsValid(selectedTree);
             newTrees.Add(selectedTree);
@@ -90,8 +92,6 @@
               par0 = (SymbolicExpressionTree)trees.SelectRandom(random).Clone();
               par1 = (SymbolicExpressionTree)trees.SelectRandom(random).Clone();
-            } while (par0.Size > MAX_TREE_SIZE || par1.Size > MAX_TREE_SIZE);
-            bool success;
-            newTrees.Add(SubtreeCrossover.Cross(random, par0, par1, 0.9, MAX_TREE_SIZE, MAX_TREE_HEIGHT, out success));
-            Assert.IsTrue(success); // crossover must succeed
+            } while (par0.Length > MAX_TREE_LENGTH || par1.Length > MAX_TREE_LENGTH);
+            newTrees.Add(SubtreeCrossover.Cross(random, par0, par1, 0.9, MAX_TREE_LENGTH, MAX_TREE_DEPTH));
           }
         }
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ArgumentCreaterTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ArgumentCreaterTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ArgumentCreaterTest.cs	(revision 5549)
@@ -24,16 +24,13 @@
 using System.Collections.Generic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class ArgumentCreaterTest {
     private const int POPULATION_SIZE = 1000;
-    private const int MAX_TREE_SIZE = 100;
-    private const int MAX_TREE_HEIGHT = 10;
+    private const int MAX_TREE_LENGTH = 100;
+    private const int MAX_TREE_DEPTH = 10;
     private TestContext testContextInstance;
 
@@ -53,14 +50,14 @@
     [TestMethod()]
     public void ArgumentCreaterDistributionsTest() {
-      var trees = new List<SymbolicExpressionTree>();
+      var trees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister(31415);
       int failedOps = 0;
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        SymbolicExpressionTree tree;
+        ISymbolicExpressionTree tree;
         do {
-          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
         } while (!TreeHasAdfWithParameter(tree, 3));
-        var success = ArgumentCreater.CreateNewArgument(random, tree, grammar, 60000, 100, 3, 3);
+        var success = ArgumentCreater.CreateNewArgument(random, tree, 60000, 100, 3, 3);
         if (!success) failedOps++;
         Util.IsValid(tree);
@@ -79,7 +76,8 @@
     }
 
-    private bool TreeHasAdfWithParameter(SymbolicExpressionTree tree, int maxParameters) {
-      return tree.Root.SubTrees.Count == 2 &&
-      tree.Root.SubTrees[1].GetAllowedSymbols(0).Where(x => x is Argument).Count() < maxParameters;
+    private bool TreeHasAdfWithParameter(ISymbolicExpressionTree tree, int maxParameters) {
+      if(tree.Root.SubTrees.Count() != 2 ) return false;
+      var firstAdf = tree.Root.GetSubTree(1);
+      return firstAdf.Grammar.GetAllowedSymbols(firstAdf.Symbol, 0).Where(x => x is Argument).Count() < maxParameters;
     }
   }
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ArgumentDeleterTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ArgumentDeleterTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ArgumentDeleterTest.cs	(revision 5549)
@@ -24,16 +24,13 @@
 using System.Collections.Generic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class ArgumentDeleterTest {
     private const int POPULATION_SIZE = 1000;
-    private const int MAX_TREE_SIZE = 100;
-    private const int MAX_TREE_HEIGHT = 10;
+    private const int MAX_TREE_LENGTH = 100;
+    private const int MAX_TREE_DEPTH = 10;
     private TestContext testContextInstance;
 
@@ -53,13 +50,13 @@
     [TestMethod()]
     public void ArgumentDeleterDistributionsTest() {
-      var trees = new List<SymbolicExpressionTree>();
+      var trees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister(31415);
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        SymbolicExpressionTree tree = null;
+        ISymbolicExpressionTree tree = null;
         do {
-          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
         } while (!TreeHasAdfWithArguments(tree));
-        var success = ArgumentDeleter.DeleteArgument(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        var success = ArgumentDeleter.DeleteArgument(random, tree, 3, 3);
         Assert.IsTrue(success);
         Util.IsValid(tree);
@@ -73,7 +70,8 @@
         );
     }
-    private bool TreeHasAdfWithArguments(SymbolicExpressionTree tree) {
-      return tree.Root.SubTrees.Count == 2 &&
-        tree.Root.SubTrees[1].GetAllowedSymbols(0).Where(x => x is Argument).Count() >= 2;
+    private bool TreeHasAdfWithArguments(ISymbolicExpressionTree tree) {
+      if (tree.Root.SubTrees.Count() != 2) return false;
+      var firstAdf = tree.Root.GetSubTree(1);
+      return firstAdf.Grammar.GetAllowedSymbols(firstAdf.Symbol, 0).Where(x => x is Argument).Count() >= 2;
     }
   }
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ArgumentDuplicaterTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ArgumentDuplicaterTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ArgumentDuplicaterTest.cs	(revision 5549)
@@ -24,16 +24,13 @@
 using System.Collections.Generic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class ArgumentDuplicaterTest {
     private const int POPULATION_SIZE = 1000;
-    private const int MAX_TREE_SIZE = 100;
-    private const int MAX_TREE_HEIGHT = 10;
+    private const int MAX_TREE_LENGTH = 100;
+    private const int MAX_TREE_DEPTH = 10;
     private TestContext testContextInstance;
 
@@ -53,13 +50,13 @@
     [TestMethod()]
     public void ArgumentDuplicaterDistributionsTest() {
-      var trees = new List<SymbolicExpressionTree>();
+      var trees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister(31415);
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        SymbolicExpressionTree tree = null;
+        ISymbolicExpressionTree tree = null;
         do {
-          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
         } while(!HasAdfWithArguments(tree));
-        var success = ArgumentDuplicater.DuplicateArgument(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        var success = ArgumentDuplicater.DuplicateArgument(random, tree, 3, 3);
         Assert.IsTrue(success);
         Util.IsValid(tree);
@@ -74,7 +71,8 @@
     }
 
-    private bool HasAdfWithArguments(SymbolicExpressionTree tree) {
-      return tree.Root.SubTrees.Count == 2 &&
-        tree.Root.SubTrees[1].GetAllowedSymbols(0).Where(x => x is Argument).Count() == 1;
+    private bool HasAdfWithArguments(ISymbolicExpressionTree tree) {
+      if (tree.Root.SubTrees.Count() != 2) return false;
+      var firstAdf = tree.Root.GetSubTree(1);
+      return firstAdf.Grammar.GetAllowedSymbols(firstAdf.Symbol, 0).Where(x => x is Argument).Count() == 1;
     }
   }
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ChangeNodeTypeManipulationTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ChangeNodeTypeManipulationTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ChangeNodeTypeManipulationTest.cs	(revision 5549)
@@ -23,15 +23,13 @@
 using System.Collections.Generic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class ChangeNodeTypeManipulationTest {
     private const int POPULATION_SIZE = 1000;
-    private const int MAX_TREE_SIZE = 100;
-    private const int MAX_TREE_HEIGHT = 10;
+    private const int MAX_TREE_LENGTH = 100;
+    private const int MAX_TREE_DEPTH = 10;
     private TestContext testContextInstance;
 
@@ -51,12 +49,14 @@
     [TestMethod()]
     public void ChangeNodeTypeManipulationDistributionsTest() {
-      var trees = new List<SymbolicExpressionTree>();
+      SymbolicExpressionTreeStringFormatter formatter = new SymbolicExpressionTreeStringFormatter();
+      var trees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister(31415);
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
-        bool success;
-        ChangeNodeTypeManipulation.ChangeNodeType(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, out success);
-        Assert.IsTrue(success);
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
+        string originalTree = formatter.Format(tree);
+        ChangeNodeTypeManipulation.ChangeNodeType(random, tree);
+        string manipulatedTree = formatter.Format(tree);
+        Assert.IsFalse(originalTree == manipulatedTree);
         Util.IsValid(tree);
         trees.Add(tree);
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/Grammars.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/Grammars.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/Grammars.cs	(revision 5549)
@@ -23,7 +23,6 @@
 using HeuristicLab.Common;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   public static class Grammars {
     private class Addition : Symbol {
@@ -109,5 +108,5 @@
     }
 
-    public static ISymbolicExpressionGrammar CreateSimpleArithmeticGrammar() {
+    public static ISymbolicExpressionTreeGrammar CreateSimpleArithmeticGrammar() {
       var g = new GlobalSymbolicExpressionGrammar(new SimpleArithmeticGrammar());
       g.MaxFunctionArguments = 0;
@@ -118,5 +117,5 @@
     }
 
-    public static ISymbolicExpressionGrammar CreateArithmeticAndAdfGrammar() {
+    public static ISymbolicExpressionTreeGrammar CreateArithmeticAndAdfGrammar() {
       var g = new GlobalSymbolicExpressionGrammar(new SimpleArithmeticGrammar());
       g.MaxFunctionArguments = 3;
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.Tests.csproj
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.Tests.csproj	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.Tests.csproj	(revision 5549)
@@ -9,5 +9,5 @@
     <OutputType>Library</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests</RootNamespace>
+    <RootNamespace>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests</RootNamespace>
     <AssemblyName>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.Tests</AssemblyName>
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
@@ -153,7 +153,7 @@
       <Name>HeuristicLab.Random-3.3</Name>
     </ProjectReference>
-    <ProjectReference Include="..\..\3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj">
-      <Project>{125D3006-67F5-48CB-913E-73C0548F17FA}</Project>
-      <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3</Name>
+    <ProjectReference Include="..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj">
+      <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project>
+      <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name>
     </ProjectReference>
   </ItemGroup>
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ProbabilisticTreeCreaterTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ProbabilisticTreeCreaterTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ProbabilisticTreeCreaterTest.cs	(revision 5549)
@@ -23,14 +23,14 @@
 using System.Collections.Generic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System.Diagnostics;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class ProbabilisticTreeCreaterTest {
-    private const int POPULATION_SIZE = 1000;
-    private const int MAX_TREE_SIZE = 100;
-    private const int MAX_TREE_HEIGHT = 10;
+    private const int POPULATION_SIZE = 10000;
+    private const int MAX_TREE_LENGTH = 100;
+    private const int MAX_TREE_DEPTH = 10;
     private TestContext testContextInstance;
 
@@ -50,15 +50,21 @@
     [TestMethod()]
     public void ProbabilisticTreeCreaterDistributionsTest() {
-      var randomTrees = new List<SymbolicExpressionTree>();
+      var randomTrees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateSimpleArithmeticGrammar();
       var random = new MersenneTwister(31415);
+      var stopwatch = new Stopwatch();
+      stopwatch.Start();
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        randomTrees.Add(ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 0, 0));
+        randomTrees.Add(ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 0, 0));
       }
+      stopwatch.Stop();
 
       foreach (var tree in randomTrees) {
         Util.IsValid(tree);
       }
+      double msPerRandomTreeCreation = stopwatch.ElapsedMilliseconds / (double)POPULATION_SIZE;
+
       Console.WriteLine("ProbabilisticTreeCreator: " + Environment.NewLine +
+        msPerRandomTreeCreation + " ms per random tree (~" + Math.Round(1000.0 / (msPerRandomTreeCreation)) + "random trees / s)" + Environment.NewLine +
         Util.GetSizeDistributionString(randomTrees, 105, 5) + Environment.NewLine +
         Util.GetFunctionDistributionString(randomTrees) + Environment.NewLine +
@@ -66,4 +72,5 @@
         Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine
         );
+      Assert.IsTrue(Math.Round(1000.0 / (msPerRandomTreeCreation)) > 2000); // must achieve more than 2000 random trees / s
     }
 
@@ -71,13 +78,21 @@
     [TestMethod()]
     public void ProbabilisticTreeCreaterWithAdfDistributionsTest() {
-      var randomTrees = new List<SymbolicExpressionTree>();
+      var randomTrees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister(31415);
+      var stopwatch = new Stopwatch();
+      stopwatch.Start();
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
-        Util.IsValid(tree);
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
         randomTrees.Add(tree);
       }
+      stopwatch.Stop();
+      foreach (var tree in randomTrees)
+        Util.IsValid(tree);
+
+      double msPerRandomTreeCreation = stopwatch.ElapsedMilliseconds / (double)POPULATION_SIZE;
+
       Console.WriteLine("ProbabilisticTreeCreator: " + Environment.NewLine +
+        msPerRandomTreeCreation + " ms per random tree (~" + Math.Round(1000.0 / (msPerRandomTreeCreation)) + "random trees / s)" + Environment.NewLine +
         Util.GetSizeDistributionString(randomTrees, 105, 5) + Environment.NewLine +
         Util.GetFunctionDistributionString(randomTrees) + Environment.NewLine +
@@ -85,4 +100,6 @@
         Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine
         );
+
+      Assert.IsTrue(Math.Round(1000.0 / (msPerRandomTreeCreation)) > 2000); // must achieve more than 2000 random trees / s
     }
   }
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ReplaceBranchManipulationTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ReplaceBranchManipulationTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ReplaceBranchManipulationTest.cs	(revision 5549)
@@ -23,15 +23,13 @@
 using System.Collections.Generic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class ReplaceBranchManipulationTest {
     private const int POPULATION_SIZE = 1000;
-    private const int MAX_TREE_SIZE = 100;
-    private const int MAX_TREE_HEIGHT = 10;
+    private const int MAX_TREE_LENGTH = 100;
+    private const int MAX_TREE_DEPTH = 10;
     private TestContext testContextInstance;
 
@@ -51,12 +49,14 @@
     [TestMethod()]
     public void ReplaceBranchManipulationDistributionsTest() {
-      var trees = new List<SymbolicExpressionTree>();
+      SymbolicExpressionTreeStringFormatter formatter = new SymbolicExpressionTreeStringFormatter();
+      var trees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister(31415);
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
-        bool success;
-        ReplaceBranchManipulation.ReplaceRandomBranch(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, out success);
-        Assert.IsTrue(success);
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
+        string originalTree = formatter.Format(tree);
+        ReplaceBranchManipulation.ReplaceRandomBranch(random, tree, MAX_TREE_LENGTH, MAX_TREE_DEPTH);
+        string manipulatedTree = formatter.Format(tree);
+        Assert.IsFalse(originalTree == manipulatedTree);
         Util.IsValid(tree);
         trees.Add(tree);
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubroutineCreaterTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubroutineCreaterTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubroutineCreaterTest.cs	(revision 5549)
@@ -21,17 +21,16 @@
 
 using System;
+using System.Linq;
 using System.Collections.Generic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class SubroutineCreaterTest {
     private const int POPULATION_SIZE = 1000;
-    private const int MAX_TREE_SIZE = 100;
-    private const int MAX_TREE_HEIGHT = 10;
+    private const int MAX_TREE_LENGTH = 100;
+    private const int MAX_TREE_DEPTH = 10;
     private TestContext testContextInstance;
 
@@ -51,13 +50,13 @@
     [TestMethod()]
     public void SubroutineCreaterDistributionsTest() {
-      var trees = new List<SymbolicExpressionTree>();
+      var trees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister(31415);
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        SymbolicExpressionTree tree = null;
+        ISymbolicExpressionTree tree = null;
         do {
-          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
         } while ( !OneMoreAdfAllowed(tree));
-        var success = SubroutineCreater.CreateSubroutine(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        var success = SubroutineCreater.CreateSubroutine(random, tree, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
         Assert.IsTrue(success);
         Util.IsValid(tree);
@@ -72,6 +71,6 @@
     }
 
-    private bool OneMoreAdfAllowed(SymbolicExpressionTree tree) {
-      return tree.Size < 80 && tree.Root.SubTrees.Count < 4;
+    private bool OneMoreAdfAllowed(ISymbolicExpressionTree tree) {
+      return tree.Length < 80 && tree.Root.SubTrees.Count() < 4;
     }
   }
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubroutineDeleterTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubroutineDeleterTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubroutineDeleterTest.cs	(revision 5549)
@@ -21,17 +21,16 @@
 
 using System;
+using System.Linq;
 using System.Collections.Generic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class SubroutineDeleterTest {
     private const int POPULATION_SIZE = 1000;
-    private const int MAX_TREE_SIZE = 100;
-    private const int MAX_TREE_HEIGHT = 10;
+    private const int MAX_TREE_LENGTH = 100;
+    private const int MAX_TREE_DEPTH = 10;
     private TestContext testContextInstance;
 
@@ -51,13 +50,13 @@
     [TestMethod()]
     public void SubroutineDeleterDistributionsTest() {
-      var trees = new List<SymbolicExpressionTree>();
+      var trees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister(31415);
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        SymbolicExpressionTree tree = null;
+        ISymbolicExpressionTree tree = null;
         do {
-          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
         } while (!HasAtLeastOneAdf(tree));
-        var success = SubroutineDeleter.DeleteSubroutine(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        var success = SubroutineDeleter.DeleteSubroutine(random, tree, 3, 3);
         Assert.IsTrue(success);
         Util.IsValid(tree);
@@ -72,6 +71,6 @@
     }
 
-    private bool HasAtLeastOneAdf(SymbolicExpressionTree tree) {
-      return tree.Root.SubTrees.Count > 1;
+    private bool HasAtLeastOneAdf(ISymbolicExpressionTree tree) {
+      return tree.Root.SubTrees.Count() > 1;
     }
   }
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubroutineDuplicaterTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubroutineDuplicaterTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubroutineDuplicaterTest.cs	(revision 5549)
@@ -21,17 +21,16 @@
 
 using System;
+using System.Linq;
 using System.Collections.Generic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class SubroutineDuplicaterTest {
     private const int POPULATION_SIZE = 1000;
-    private const int MAX_TREE_SIZE = 100;
-    private const int MAX_TREE_HEIGHT = 10;
+    private const int MAX_TREE_LENGTH = 100;
+    private const int MAX_TREE_DEPTH = 10;
     private TestContext testContextInstance;
 
@@ -51,13 +50,13 @@
     [TestMethod()]
     public void SubroutineDuplicaterDistributionsTest() {
-      var trees = new List<SymbolicExpressionTree>();
+      var trees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister();
       for (int i = 0; i < POPULATION_SIZE; i++) {
-        SymbolicExpressionTree tree = null;
+        ISymbolicExpressionTree tree = null;
         do {
-          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+          tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_LENGTH, MAX_TREE_DEPTH, 3, 3);
         } while (!HasOneAdf(tree));
-        var success = SubroutineDuplicater.DuplicateSubroutine(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        var success = SubroutineDuplicater.DuplicateSubroutine(random, tree, 3, 3);
         Assert.IsTrue(success);
         Util.IsValid(tree);
@@ -72,6 +71,6 @@
     }
 
-    private bool HasOneAdf(SymbolicExpressionTree tree) {
-      return tree.Root.SubTrees.Count == 2;
+    private bool HasOneAdf(ISymbolicExpressionTree tree) {
+      return tree.Root.SubTrees.Count() == 2;
     }
   }
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubtreeCrossoverTest.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubtreeCrossoverTest.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubtreeCrossoverTest.cs	(revision 5549)
@@ -24,10 +24,8 @@
 using System.Diagnostics;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Crossovers;
 using HeuristicLab.Random;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   [TestClass]
   public class SubtreeCrossoverTest {
@@ -51,8 +49,8 @@
     public void SubtreeCrossoverDistributionsTest() {
       int generations = 5;
-      var trees = new List<SymbolicExpressionTree>();
+      var trees = new List<ISymbolicExpressionTree>();
       var grammar = Grammars.CreateArithmeticAndAdfGrammar();
       var random = new MersenneTwister(31415);
-      List<SymbolicExpressionTree> crossoverTrees;
+      List<ISymbolicExpressionTree> crossoverTrees;
       double msPerCrossoverEvent;
 
@@ -63,11 +61,9 @@
       stopwatch.Start();
       for (int gCount = 0; gCount < generations; gCount++) {
-        var newPopulation = new List<SymbolicExpressionTree>();
+        var newPopulation = new List<ISymbolicExpressionTree>();
         for (int i = 0; i < POPULATION_SIZE; i++) {
           var par0 = (SymbolicExpressionTree)trees.SelectRandom(random).Clone();
           var par1 = (SymbolicExpressionTree)trees.SelectRandom(random).Clone();
-          bool success;
-          newPopulation.Add(SubtreeCrossover.Cross(random, par0, par1, 0.9, 100, 10, out success));
-          Assert.IsTrue(success);
+          newPopulation.Add(SubtreeCrossover.Cross(random, par0, par1, 0.9, 100, 10));
         }
         crossoverTrees = newPopulation;
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/Util.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/Util.cs	(revision 5477)
+++ branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/Util.cs	(revision 5549)
@@ -25,13 +25,12 @@
 using System.Text;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
   public static class Util {
-    public static string GetSizeDistributionString(IList<SymbolicExpressionTree> trees, int maxTreeSize, int binSize) {
-      int[] histogram = new int[maxTreeSize / binSize];
+    public static string GetSizeDistributionString(IList<ISymbolicExpressionTree> trees, int maxTreeLength, int binSize) {
+      int[] histogram = new int[maxTreeLength / binSize];
       for (int i = 0; i < trees.Count; i++) {
-        int binIndex = Math.Min(histogram.Length - 1, trees[i].Size / binSize);
+        int binIndex = Math.Min(histogram.Length - 1, trees[i].Length / binSize);
         histogram[binIndex]++;
       }
@@ -49,10 +48,10 @@
     }
 
-    public static string GetFunctionDistributionString(IList<SymbolicExpressionTree> trees) {
+    public static string GetFunctionDistributionString(IList<ISymbolicExpressionTree> trees) {
       Dictionary<string, int> occurances = new Dictionary<string, int>();
       double n = 0.0;
       for (int i = 0; i < trees.Count; i++) {
         foreach (var node in trees[i].IterateNodesPrefix()) {
-          if (node.SubTrees.Count > 0) {
+          if (node.SubTrees.Count() > 0) {
             if (!occurances.ContainsKey(node.Symbol.Name))
               occurances[node.Symbol.Name] = 0;
@@ -71,12 +70,12 @@
     }
 
-    public static string GetNumberOfSubTreesDistributionString(IList<SymbolicExpressionTree> trees) {
+    public static string GetNumberOfSubTreesDistributionString(IList<ISymbolicExpressionTree> trees) {
       Dictionary<int, int> occurances = new Dictionary<int, int>();
       double n = 0.0;
       for (int i = 0; i < trees.Count; i++) {
         foreach (var node in trees[i].IterateNodesPrefix()) {
-          if (!occurances.ContainsKey(node.SubTrees.Count))
-            occurances[node.SubTrees.Count] = 0;
-          occurances[node.SubTrees.Count]++;
+          if (!occurances.ContainsKey(node.SubTrees.Count()))
+            occurances[node.SubTrees.Count()] = 0;
+          occurances[node.SubTrees.Count()]++;
           n++;
         }
@@ -92,10 +91,10 @@
 
 
-    public static string GetTerminalDistributionString(IList<SymbolicExpressionTree> trees) {
+    public static string GetTerminalDistributionString(IList<ISymbolicExpressionTree> trees) {
       Dictionary<string, int> occurances = new Dictionary<string, int>();
       double n = 0.0;
       for (int i = 0; i < trees.Count; i++) {
         foreach (var node in trees[i].IterateNodesPrefix()) {
-          if (node.SubTrees.Count == 0) {
+          if (node.SubTrees.Count() == 0) {
             if (!occurances.ContainsKey(node.Symbol.Name))
               occurances[node.Symbol.Name] = 0;
@@ -114,6 +113,6 @@
     }
 
-    public static void IsValid(SymbolicExpressionTree tree) {
-      int reportedSize = tree.Size;
+    public static void IsValid(ISymbolicExpressionTree tree) {
+      int reportedSize = tree.Length;
       int actualSize = tree.IterateNodesPostfix().Count();
       Assert.AreEqual(actualSize, reportedSize);
@@ -135,14 +134,14 @@
     }
 
-    public static void IsValid(SymbolicExpressionTreeNode treeNode) {
+    public static void IsValid(ISymbolicExpressionTreeNode treeNode) {
       var matchingSymbol = (from symb in treeNode.Grammar.Symbols
                             where symb.Name == treeNode.Symbol.Name
                             select symb).SingleOrDefault();
-      Assert.IsTrue(treeNode.SubTrees.Count >= treeNode.Grammar.GetMinSubtreeCount(matchingSymbol));
-      Assert.IsTrue(treeNode.SubTrees.Count <= treeNode.Grammar.GetMaxSubtreeCount(matchingSymbol));
+      Assert.IsTrue(treeNode.SubTrees.Count() >= treeNode.Grammar.GetMinSubtreeCount(matchingSymbol));
+      Assert.IsTrue(treeNode.SubTrees.Count() <= treeNode.Grammar.GetMaxSubtreeCount(matchingSymbol));
       Assert.AreNotEqual(0.0, matchingSymbol.InitialFrequency); // check that no deactivated symbols occur in the tree
-      for (int i = 0; i < treeNode.SubTrees.Count; i++) {
-        Assert.IsTrue(treeNode.GetAllowedSymbols(i).Select(x => x.Name).Contains(treeNode.SubTrees[i].Symbol.Name));
-        IsValid(treeNode.SubTrees[i]);
+      for (int i = 0; i < treeNode.SubTrees.Count(); i++) {
+        Assert.IsTrue(treeNode.Grammar.GetAllowedSymbols(treeNode.Symbol, i).Select(x => x.Name).Contains(treeNode.GetSubTree(i).Symbol.Name));
+        IsValid(treeNode.GetSubTree(i));
       }
     }
