Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs	(revision 6929)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs	(revision 6944)
@@ -21,6 +21,4 @@
 
 using System;
-using System.Collections.Generic;
-using System.ComponentModel;
 using System.Linq;
 using HeuristicLab.Common;
@@ -133,12 +131,12 @@
         throw new ArgumentException("Cannot create trees of depth " + maxDepth + " or smaller because of grammar constraints.", "maxDepth");
 
-      var possibleSymbols = seedNode.Grammar.GetAllowedChildSymbols(seedNode.Symbol).Where(s => s.InitialFrequency > 0.0 && seedNode.Grammar.GetMaximumSubtreeCount(s) > 0).ToList();
 
       int arity = seedNode.Grammar.GetMaximumSubtreeCount(seedNode.Symbol);
       // Throw an exception if the seedNode happens to be a terminal, since in this case we cannot grow a tree.
       if (arity <= 0)
-        throw new ArgumentException("Cannot grow tree. Seed node shouldn't have arity zero."); 
+        throw new ArgumentException("Cannot grow tree. Seed node shouldn't have arity zero.");
 
       for (var i = 0; i != arity; ++i) {
+        var possibleSymbols = seedNode.Grammar.GetAllowedChildSymbols(seedNode.Symbol,i).Where(s => s.InitialFrequency > 0.0 && seedNode.Grammar.GetMaximumSubtreeCount(s) > 0);
         var selectedSymbol = possibleSymbols.SelectRandom(random);
         var tree = selectedSymbol.CreateTreeNode();
@@ -149,5 +147,5 @@
       // Only iterate over the non-terminal nodes (those which have arity > 0)
       // Start from depth 2 since the first two levels are formed by the rootNode and the seedNode
-      foreach (var subTree in seedNode.Subtrees.Where(subTree => subTree.Grammar.GetMaximumSubtreeCount(subTree.Symbol) != 0)) 
+      foreach (var subTree in seedNode.Subtrees.Where(subTree => subTree.Grammar.GetMaximumSubtreeCount(subTree.Symbol) != 0))
         RecursiveGrowFull(random, subTree, 2, maxDepth);
     }
@@ -159,9 +157,9 @@
         throw new ArgumentException("Cannot grow node of arity zero. Expected a function node.");
 
-      var possibleSymbols = currentDepth < maxDepth ?
-        root.Grammar.GetAllowedChildSymbols(root.Symbol).Where(s => s.InitialFrequency > 0.0 && root.Grammar.GetMaximumSubtreeCount(s) > 0).ToList() :
-        root.Grammar.GetAllowedChildSymbols(root.Symbol).Where(s => s.InitialFrequency > 0.0 && root.Grammar.GetMaximumSubtreeCount(s) == 0).ToList();
 
       for (var i = 0; i != arity; ++i) {
+        var possibleSymbols = currentDepth < maxDepth ?
+          root.Grammar.GetAllowedChildSymbols(root.Symbol,i).Where(s => s.InitialFrequency > 0.0 && root.Grammar.GetMaximumSubtreeCount(s) > 0) :
+          root.Grammar.GetAllowedChildSymbols(root.Symbol,i).Where(s => s.InitialFrequency > 0.0 && root.Grammar.GetMaximumSubtreeCount(s) == 0);
         var selectedSymbol = possibleSymbols.SelectRandom(random);
         var tree = selectedSymbol.CreateTreeNode();
Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs	(revision 6929)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs	(revision 6944)
@@ -21,6 +21,4 @@
 
 using System;
-using System.Collections.Generic;
-using System.ComponentModel;
 using System.Linq;
 using HeuristicLab.Common;
@@ -134,10 +132,10 @@
       var arity = SampleArity(random, seedNode);
       // throw an exception if the seedNode happens to be a terminal, since in this case we cannot grow a tree
-      if (arity <= 0) 
-        throw new ArgumentException("Cannot grow tree. Seed node shouldn't have arity zero."); 
+      if (arity <= 0)
+        throw new ArgumentException("Cannot grow tree. Seed node shouldn't have arity zero.");
 
-      var possibleSymbols = seedNode.Grammar.GetAllowedChildSymbols(seedNode.Symbol).Where(s => s.InitialFrequency > 0.0).ToList();
 
       for (var i = 0; i != arity; ++i) {
+        var possibleSymbols = seedNode.Grammar.GetAllowedChildSymbols(seedNode.Symbol, i).Where(s => s.InitialFrequency > 0.0);
         var selectedSymbol = possibleSymbols.SelectRandom(random);
         var tree = selectedSymbol.CreateTreeNode();
@@ -157,9 +155,10 @@
         throw new ArgumentException("Cannot grow node of arity zero. Expected a function node.");
 
-      var possibleSymbols = currentDepth < maxDepth ?
-        root.Grammar.GetAllowedChildSymbols(root.Symbol).Where(s => s.InitialFrequency > 0.0).ToList() :
-        root.Grammar.GetAllowedChildSymbols(root.Symbol).Where(s => s.InitialFrequency > 0.0 && root.Grammar.GetMaximumSubtreeCount(s) == 0).ToList();
 
       for (var i = 0; i != arity; ++i) {
+        var possibleSymbols = currentDepth < maxDepth
+                                ? root.Grammar.GetAllowedChildSymbols(root.Symbol,i).Where(s => s.InitialFrequency > 0.0)
+                                : root.Grammar.GetAllowedChildSymbols(root.Symbol,i).Where(
+                                  s => s.InitialFrequency > 0.0 && root.Grammar.GetMaximumSubtreeCount(s) == 0);
         var selectedSymbol = possibleSymbols.SelectRandom(random);
         var tree = selectedSymbol.CreateTreeNode();
