Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Addition.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Addition.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Addition.cs	(revision 2202)
@@ -42,8 +42,6 @@
       : base() {
       // 2 - 3 seems like an reasonable defaut (used for +,-,*,/) (discussion with swinkler and maffenze)
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
-      AddConstraint(new SubOperatorTypeConstraint(2));
+      MinArity = 2;
+      MaxArity = 3;
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/And.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/And.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/And.cs	(revision 2202)
@@ -38,8 +38,5 @@
     public And()
       : base() {
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
-      AddConstraint(new SubOperatorTypeConstraint(2));
+      MinArity = 2; MaxArity = 3;
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Average.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Average.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Average.cs	(revision 2202)
@@ -36,8 +36,5 @@
     public Average()
       : base() {
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
-      AddConstraint(new SubOperatorTypeConstraint(2));
+      MinArity = 2; MaxArity = 3;
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BakedTreeEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BakedTreeEvaluator.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BakedTreeEvaluator.cs	(revision 2202)
@@ -183,7 +183,4 @@
             return Math.Abs(x - y);
           }
-        case EvaluatorSymbolTable.UNKNOWN: { // evaluate functions which are not statically defined directly
-            return currInstr.function.Apply();
-          }
         default: {
             throw new NotImplementedException();
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/BinaryFunction.cs
===================================================================
--- branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/BinaryFunction.cs	(revision 2202)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/BinaryFunction.cs	(revision 2202)
@@ -0,0 +1,35 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+
+namespace HeuristicLab.GP.StructureIdentification {
+  public abstract class BinaryFunction : FunctionBase {
+    public BinaryFunction()
+      : base() {
+      MinArity = 2; MaxArity = 2;
+    }
+  }
+}
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/Terminal.cs
===================================================================
--- branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/Terminal.cs	(revision 2202)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/Terminal.cs	(revision 2202)
@@ -0,0 +1,35 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+
+namespace HeuristicLab.GP.StructureIdentification {
+  public abstract class Terminal : FunctionBase {
+    public Terminal()
+      : base() {
+      MinArity = 0; MaxArity = 0;
+    }
+  }
+}
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/UnaryFunction.cs
===================================================================
--- branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/UnaryFunction.cs	(revision 2202)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/UnaryFunction.cs	(revision 2202)
@@ -0,0 +1,35 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+
+namespace HeuristicLab.GP.StructureIdentification {
+  public abstract class UnaryFunction : FunctionBase {
+    public UnaryFunction()
+      : base() {
+      MinArity = 1; MaxArity = 1;
+    }
+  }
+}
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Constant.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Constant.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Constant.cs	(revision 2202)
@@ -32,6 +32,7 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Constant : FunctionBase {
+  public sealed class Constant : Terminal {
     public const string VALUE = "Value";
+    private BakedFunctionTree constantNodeTemplate;
 
     public override string Description {
@@ -39,25 +40,26 @@
     }
 
+    public override IEnumerable<string> LocalParameterNames {
+      get {
+        return new string[] { VALUE };
+      }
+    }
+
     public Constant()
       : base() {
-      AddVariableInfo(new VariableInfo(VALUE, "The constant value", typeof(DoubleData), VariableKind.None));
-      GetVariableInfo(VALUE).Local = true;
-
       DoubleData valueData = new DoubleData();
-      // initialize a default range for the contant value
-      HeuristicLab.Core.Variable value = new HeuristicLab.Core.Variable(VALUE, valueData);
-      AddVariable(value);
+      constantNodeTemplate = new BakedFunctionTree(this);
+      constantNodeTemplate.AddVariable(new HeuristicLab.Core.Variable(VALUE, valueData));
 
       SetupInitialization();
       SetupManipulation();
+    }
 
-      // constant can't have suboperators
-      AddConstraint(new NumberOfSubOperatorsConstraint(0, 0));
+    public override IFunctionTree GetTreeNode() {
+      return (IFunctionTree)constantNodeTemplate.Clone();
     }
 
     private void SetupInitialization() {
       // initialization operator
-      AddVariableInfo(new VariableInfo(INITIALIZATION, "Initialization operator-graph for constants", typeof(IOperatorGraph), VariableKind.None));
-      GetVariableInfo(INITIALIZATION).Local = false;
       CombinedOperator combinedOp = new CombinedOperator();
       SequentialProcessor initSeq = new SequentialProcessor();
@@ -70,11 +72,9 @@
       combinedOp.OperatorGraph.InitialOperator = initSeq;
       initSeq.AddSubOperator(randomizer);
-      AddVariable(new HeuristicLab.Core.Variable(INITIALIZATION, combinedOp));
+      Initializer = combinedOp;
     }
 
     private void SetupManipulation() {
       // manipulation operator
-      AddVariableInfo(new VariableInfo(MANIPULATION, "Manipulation operator-graph for constants", typeof(IOperatorGraph), VariableKind.None));
-      GetVariableInfo(MANIPULATION).Local = false;
       CombinedOperator combinedOp = new CombinedOperator();
       SequentialProcessor manipulationSeq = new SequentialProcessor();
@@ -87,5 +87,5 @@
       combinedOp.OperatorGraph.InitialOperator = manipulationSeq;
       manipulationSeq.AddSubOperator(valueAdder);
-      AddVariable(new HeuristicLab.Core.Variable(MANIPULATION, combinedOp));
+      Manipulator = combinedOp;
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Cosinus.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Cosinus.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Cosinus.cs	(revision 2202)
@@ -29,5 +29,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Cosinus : FunctionBase {
+  public sealed class Cosinus : UnaryFunction {
     public override string Description {
       get { return "Returns the cosinus of the first sub-tree."; }
@@ -36,7 +36,4 @@
     public Cosinus()
       : base() {
-      // must have exactly one subfunction
-      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
-      AddConstraint(new SubOperatorTypeConstraint(0));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Differential.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Differential.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Differential.cs	(revision 2202)
@@ -40,7 +40,5 @@
     }
 
-    public Differential()
-      : base() {
-    }
+    public Differential() : base() { }
   }
 }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Division.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Division.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Division.cs	(revision 2202)
@@ -30,7 +30,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Division : FunctionBase {
-    private const double EPSILON = 10.0E-20; // if any divisor is < EPSILON return 0
-
+  public sealed class Division : BinaryFunction {
     public override string Description {
       get {
@@ -46,12 +44,5 @@
     }
 
-    public Division()
-      : base() {
-      // 2 - 3 seems like an reasonable defaut (used for +,-,*,/) (discussion with swinkler and maffenze)
-      //MK changed to only 2 allowed suboperators to be compliant with HL2
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
-    }
+    public Division() : base() { }
   }
 }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Equal.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Equal.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Equal.cs	(revision 2202)
@@ -28,5 +28,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Equal : FunctionBase {
+  public sealed class Equal : BinaryFunction {
     public override string Description {
       get {
@@ -35,10 +35,5 @@
     }
 
-    public Equal()
-      : base() {
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
-    }
+    public Equal() : base() { }
   }
 }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Exponential.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Exponential.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Exponential.cs	(revision 2202)
@@ -29,15 +29,10 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Exponential : FunctionBase {
+  public sealed class Exponential : UnaryFunction {
     public override string Description {
       get { return "Returns returns exponential of the first sub-tree (power(e, x))."; }
     }
 
-    public Exponential()
-      : base() {
-      // must have exactly one sub-operator
-      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-    }
+    public Exponential() : base() { }
   }
 }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjector.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjector.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjector.cs	(revision 2202)
@@ -72,5 +72,5 @@
       AddVariableInfo(new VariableInfo(MINTIMEOFFSET, "Minimal time offset for all features", typeof(IntData), VariableKind.In));
       AddVariableInfo(new VariableInfo(MAXTIMEOFFSET, "Maximal time offset for all feature", typeof(IntData), VariableKind.In));
-      AddVariableInfo(new VariableInfo(FUNCTIONLIBRARY, "Preconfigured default operator library", typeof(GPOperatorLibrary), VariableKind.New));
+      AddVariableInfo(new VariableInfo(FUNCTIONLIBRARY, "Preconfigured default function library", typeof(FunctionLibrary), VariableKind.New));
 
       AddVariable(DIFFERENTIALS_ALLOWED, false);
@@ -107,6 +107,5 @@
 
     public override IOperation Apply(IScope scope) {
-      StructId.Variable variable;
-      GPOperatorLibrary operatorLibrary;
+      FunctionLibrary functionLibrary = new FunctionLibrary();
       int targetVariable = GetVariableValue<IntData>(TARGETVARIABLE, scope, true).Data;
 
@@ -118,57 +117,57 @@
       int maxTimeOffset = maxTimeOffsetItem == null ? 0 : ((IntData)maxTimeOffsetItem).Data;
 
-      variable = new StructId.Variable();
-      StructId.Constant constant = new StructId.Constant();
-      StructId.Differential differential = new Differential();
-      StructId.Addition addition = new StructId.Addition();
-      StructId.And and = new StructId.And();
-      StructId.Average average = new StructId.Average();
-      StructId.Cosinus cosinus = new StructId.Cosinus();
-      StructId.Division division = new StructId.Division();
-      StructId.Equal equal = new StructId.Equal();
-      StructId.Exponential exponential = new StructId.Exponential();
-      StructId.GreaterThan greaterThan = new StructId.GreaterThan();
-      StructId.IfThenElse ifThenElse = new StructId.IfThenElse();
-      StructId.LessThan lessThan = new StructId.LessThan();
-      StructId.Logarithm logarithm = new StructId.Logarithm();
-      StructId.Multiplication multiplication = new StructId.Multiplication();
-      StructId.Not not = new StructId.Not();
-      StructId.Or or = new StructId.Or();
-      StructId.Power power = new StructId.Power();
-      StructId.Signum signum = new StructId.Signum();
-      StructId.Sinus sinus = new StructId.Sinus();
-      StructId.Sqrt sqrt = new StructId.Sqrt();
-      StructId.Subtraction subtraction = new StructId.Subtraction();
-      StructId.Tangens tangens = new StructId.Tangens();
-      StructId.Xor xor = new StructId.Xor();
-
-
-      List<IOperator> booleanFunctions = new List<IOperator>();
-      ConditionalAddOperator(AND_ALLOWED, and, booleanFunctions);
-      ConditionalAddOperator(EQUAL_ALLOWED, equal, booleanFunctions);
-      ConditionalAddOperator(GREATERTHAN_ALLOWED, greaterThan, booleanFunctions);
-      ConditionalAddOperator(LESSTHAN_ALLOWED, lessThan, booleanFunctions);
-      ConditionalAddOperator(NOT_ALLOWED, not, booleanFunctions);
-      ConditionalAddOperator(OR_ALLOWED, or, booleanFunctions);
-      ConditionalAddOperator(XOR_ALLOWED, xor, booleanFunctions);
-
-      List<IOperator> doubleFunctions = new List<IOperator>();
-      ConditionalAddOperator(DIFFERENTIALS_ALLOWED, differential, doubleFunctions);
-      ConditionalAddOperator(VARIABLES_ALLOWED, variable, doubleFunctions);
-      ConditionalAddOperator(CONSTANTS_ALLOWED, constant, doubleFunctions);
-      ConditionalAddOperator(ADDITION_ALLOWED, addition, doubleFunctions);
-      ConditionalAddOperator(AVERAGE_ALLOWED, average, doubleFunctions);
-      ConditionalAddOperator(COSINUS_ALLOWED, cosinus, doubleFunctions);
-      ConditionalAddOperator(DIVISION_ALLOWED, division, doubleFunctions);
-      ConditionalAddOperator(EXPONENTIAL_ALLOWED, exponential, doubleFunctions);
-      ConditionalAddOperator(IFTHENELSE_ALLOWED, ifThenElse, doubleFunctions);
-      ConditionalAddOperator(LOGARTIHM_ALLOWED, logarithm, doubleFunctions);
-      ConditionalAddOperator(MULTIPLICATION_ALLOWED, multiplication, doubleFunctions);
-      ConditionalAddOperator(POWER_ALLOWED, power, doubleFunctions);
-      ConditionalAddOperator(SIGNUM_ALLOWED, signum, doubleFunctions);
-      ConditionalAddOperator(SINUS_ALLOWED, sinus, doubleFunctions);
-      ConditionalAddOperator(SQRT_ALLOWED, sqrt, doubleFunctions);
-      ConditionalAddOperator(SUBTRACTION_ALLOWED, subtraction, doubleFunctions);
-      ConditionalAddOperator(TANGENS_ALLOWED, tangens, doubleFunctions);
+      Variable variable = new Variable();
+      Constant constant = new Constant();
+      Differential differential = new Differential();
+      Addition addition = new Addition();
+      And and = new And();
+      Average average = new Average();
+      Cosinus cosinus = new Cosinus();
+      Division division = new Division();
+      Equal equal = new Equal();
+      Exponential exponential = new Exponential();
+      GreaterThan greaterThan = new GreaterThan();
+      IfThenElse ifThenElse = new IfThenElse();
+      LessThan lessThan = new LessThan();
+      Logarithm logarithm = new Logarithm();
+      Multiplication multiplication = new Multiplication();
+      Not not = new Not();
+      Or or = new Or();
+      Power power = new Power();
+      Signum signum = new Signum();
+      Sinus sinus = new Sinus();
+      Sqrt sqrt = new Sqrt();
+      Subtraction subtraction = new Subtraction();
+      Tangens tangens = new Tangens();
+      Xor xor = new Xor();
+
+
+      List<IFunction> booleanFunctions = new List<IFunction>();
+      ConditionalAddFunction(AND_ALLOWED, and, booleanFunctions);
+      ConditionalAddFunction(EQUAL_ALLOWED, equal, booleanFunctions);
+      ConditionalAddFunction(GREATERTHAN_ALLOWED, greaterThan, booleanFunctions);
+      ConditionalAddFunction(LESSTHAN_ALLOWED, lessThan, booleanFunctions);
+      ConditionalAddFunction(NOT_ALLOWED, not, booleanFunctions);
+      ConditionalAddFunction(OR_ALLOWED, or, booleanFunctions);
+      ConditionalAddFunction(XOR_ALLOWED, xor, booleanFunctions);
+
+      List<IFunction> doubleFunctions = new List<IFunction>();
+      ConditionalAddFunction(DIFFERENTIALS_ALLOWED, differential, doubleFunctions);
+      ConditionalAddFunction(VARIABLES_ALLOWED, variable, doubleFunctions);
+      ConditionalAddFunction(CONSTANTS_ALLOWED, constant, doubleFunctions);
+      ConditionalAddFunction(ADDITION_ALLOWED, addition, doubleFunctions);
+      ConditionalAddFunction(AVERAGE_ALLOWED, average, doubleFunctions);
+      ConditionalAddFunction(COSINUS_ALLOWED, cosinus, doubleFunctions);
+      ConditionalAddFunction(DIVISION_ALLOWED, division, doubleFunctions);
+      ConditionalAddFunction(EXPONENTIAL_ALLOWED, exponential, doubleFunctions);
+      ConditionalAddFunction(IFTHENELSE_ALLOWED, ifThenElse, doubleFunctions);
+      ConditionalAddFunction(LOGARTIHM_ALLOWED, logarithm, doubleFunctions);
+      ConditionalAddFunction(MULTIPLICATION_ALLOWED, multiplication, doubleFunctions);
+      ConditionalAddFunction(POWER_ALLOWED, power, doubleFunctions);
+      ConditionalAddFunction(SIGNUM_ALLOWED, signum, doubleFunctions);
+      ConditionalAddFunction(SINUS_ALLOWED, sinus, doubleFunctions);
+      ConditionalAddFunction(SQRT_ALLOWED, sqrt, doubleFunctions);
+      ConditionalAddFunction(SUBTRACTION_ALLOWED, subtraction, doubleFunctions);
+      ConditionalAddFunction(TANGENS_ALLOWED, tangens, doubleFunctions);
 
       SetAllowedSubOperators(and, booleanFunctions);
@@ -196,76 +195,53 @@
       SetAllowedSubOperators(tangens, doubleFunctions);
 
-      operatorLibrary = new GPOperatorLibrary();
-      ConditionalAddOperator(DIFFERENTIALS_ALLOWED, operatorLibrary, differential);
-      ConditionalAddOperator(VARIABLES_ALLOWED, operatorLibrary, variable);
-      ConditionalAddOperator(CONSTANTS_ALLOWED, operatorLibrary, constant);
-      ConditionalAddOperator(ADDITION_ALLOWED, operatorLibrary, addition);
-      ConditionalAddOperator(AVERAGE_ALLOWED, operatorLibrary, average);
-      ConditionalAddOperator(AND_ALLOWED, operatorLibrary, and);
-      ConditionalAddOperator(COSINUS_ALLOWED, operatorLibrary, cosinus);
-      ConditionalAddOperator(DIVISION_ALLOWED, operatorLibrary, division);
-      ConditionalAddOperator(EQUAL_ALLOWED, operatorLibrary, equal);
-      ConditionalAddOperator(EXPONENTIAL_ALLOWED, operatorLibrary, exponential);
-      ConditionalAddOperator(GREATERTHAN_ALLOWED, operatorLibrary, greaterThan);
-      ConditionalAddOperator(IFTHENELSE_ALLOWED, operatorLibrary, ifThenElse);
-      ConditionalAddOperator(LESSTHAN_ALLOWED, operatorLibrary, lessThan);
-      ConditionalAddOperator(LOGARTIHM_ALLOWED, operatorLibrary, logarithm);
-      ConditionalAddOperator(MULTIPLICATION_ALLOWED, operatorLibrary, multiplication);
-      ConditionalAddOperator(NOT_ALLOWED, operatorLibrary, not);
-      ConditionalAddOperator(POWER_ALLOWED, operatorLibrary, power);
-      ConditionalAddOperator(OR_ALLOWED, operatorLibrary, or);
-      ConditionalAddOperator(SIGNUM_ALLOWED, operatorLibrary, signum);
-      ConditionalAddOperator(SINUS_ALLOWED, operatorLibrary, sinus);
-      ConditionalAddOperator(SQRT_ALLOWED, operatorLibrary, sqrt);
-      ConditionalAddOperator(SUBTRACTION_ALLOWED, operatorLibrary, subtraction);
-      ConditionalAddOperator(TANGENS_ALLOWED, operatorLibrary, tangens);
-      ConditionalAddOperator(XOR_ALLOWED, operatorLibrary, xor);
+      ConditionalAddOperator(DIFFERENTIALS_ALLOWED, functionLibrary, differential);
+      ConditionalAddOperator(VARIABLES_ALLOWED, functionLibrary, variable);
+      ConditionalAddOperator(CONSTANTS_ALLOWED, functionLibrary, constant);
+      ConditionalAddOperator(ADDITION_ALLOWED, functionLibrary, addition);
+      ConditionalAddOperator(AVERAGE_ALLOWED, functionLibrary, average);
+      ConditionalAddOperator(AND_ALLOWED, functionLibrary, and);
+      ConditionalAddOperator(COSINUS_ALLOWED, functionLibrary, cosinus);
+      ConditionalAddOperator(DIVISION_ALLOWED, functionLibrary, division);
+      ConditionalAddOperator(EQUAL_ALLOWED, functionLibrary, equal);
+      ConditionalAddOperator(EXPONENTIAL_ALLOWED, functionLibrary, exponential);
+      ConditionalAddOperator(GREATERTHAN_ALLOWED, functionLibrary, greaterThan);
+      ConditionalAddOperator(IFTHENELSE_ALLOWED, functionLibrary, ifThenElse);
+      ConditionalAddOperator(LESSTHAN_ALLOWED, functionLibrary, lessThan);
+      ConditionalAddOperator(LOGARTIHM_ALLOWED, functionLibrary, logarithm);
+      ConditionalAddOperator(MULTIPLICATION_ALLOWED, functionLibrary, multiplication);
+      ConditionalAddOperator(NOT_ALLOWED, functionLibrary, not);
+      ConditionalAddOperator(POWER_ALLOWED, functionLibrary, power);
+      ConditionalAddOperator(OR_ALLOWED, functionLibrary, or);
+      ConditionalAddOperator(SIGNUM_ALLOWED, functionLibrary, signum);
+      ConditionalAddOperator(SINUS_ALLOWED, functionLibrary, sinus);
+      ConditionalAddOperator(SQRT_ALLOWED, functionLibrary, sqrt);
+      ConditionalAddOperator(SUBTRACTION_ALLOWED, functionLibrary, subtraction);
+      ConditionalAddOperator(TANGENS_ALLOWED, functionLibrary, tangens);
+      ConditionalAddOperator(XOR_ALLOWED, functionLibrary, xor);
 
       variable.SetConstraints(minTimeOffset, maxTimeOffset);
       differential.SetConstraints(minTimeOffset, maxTimeOffset);
 
-      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName(FUNCTIONLIBRARY), operatorLibrary));
+      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName(FUNCTIONLIBRARY), functionLibrary));
 
       return null;
     }
 
-    private void ConditionalAddOperator(string condName, IOperator op, List<IOperator> list) {
-      if (GetVariableValue<BoolData>(condName, null, false).Data) list.Add(op);
-    }
-
-    private void ConditionalAddOperator(string condName, GPOperatorLibrary operatorLibrary, IOperator op) {
-      if (GetVariableValue<BoolData>(condName, null, false).Data) operatorLibrary.GPOperatorGroup.AddOperator(op);
-    }
-
-    private void SetAllowedSubOperators(IFunction f, List<IOperator> gs) {
-      foreach (IConstraint c in f.Constraints) {
-        if (c is SubOperatorTypeConstraint) {
-          SubOperatorTypeConstraint typeConstraint = c as SubOperatorTypeConstraint;
-          typeConstraint.Clear();
-          foreach (IOperator g in gs) {
-            typeConstraint.AddOperator(g);
-          }
-        } else if (c is AllSubOperatorsTypeConstraint) {
-          AllSubOperatorsTypeConstraint typeConstraint = c as AllSubOperatorsTypeConstraint;
-          typeConstraint.Clear();
-          foreach (IOperator g in gs) {
-            typeConstraint.AddOperator(g);
-          }
-        }
+    private void ConditionalAddFunction(string condName, IFunction fun, List<IFunction> list) {
+      if (GetVariableValue<BoolData>(condName, null, false).Data) list.Add(fun);
+    }
+
+    private void ConditionalAddOperator(string condName, FunctionLibrary functionLib, IFunction op) {
+      if (GetVariableValue<BoolData>(condName, null, false).Data) functionLib.AddFunction(op);
+    }
+
+    private void SetAllowedSubOperators(IFunction f, List<IFunction> gs) {
+      for (int i = 0; i < f.MaxArity; i++) {
+        SetAllowedSubOperators(f, i, gs);
       }
     }
 
-    private void SetAllowedSubOperators(IFunction f, int p, List<IOperator> gs) {
-      foreach (IConstraint c in f.Constraints) {
-        if (c is SubOperatorTypeConstraint) {
-          SubOperatorTypeConstraint typeConstraint = c as SubOperatorTypeConstraint;
-          if (typeConstraint.SubOperatorIndex.Data == p) {
-            typeConstraint.Clear();
-            foreach (IOperator g in gs) {
-              typeConstraint.AddOperator(g);
-            }
-          }
-        }
-      }
+    private void SetAllowedSubOperators(IFunction f, int i, List<IFunction> gs) {
+      gs.ForEach((g) => f.AddAllowedSubFunction(g, i));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/GreaterThan.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/GreaterThan.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/GreaterThan.cs	(revision 2202)
@@ -27,5 +27,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class GreaterThan : FunctionBase {
+  public sealed class GreaterThan : BinaryFunction {
     public override string Description {
       get {
@@ -34,10 +34,5 @@
     }
 
-    public GreaterThan()
-      : base() {
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
-    }
+    public GreaterThan() : base() { }
   }
 }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj	(revision 2202)
@@ -86,4 +86,7 @@
     <Compile Include="Average.cs" />
     <Compile Include="BakedTreeEvaluator.cs" />
+    <Compile Include="BaseClasses\BinaryFunction.cs" />
+    <Compile Include="BaseClasses\Terminal.cs" />
+    <Compile Include="BaseClasses\UnaryFunction.cs" />
     <Compile Include="Constant.cs" />
     <Compile Include="AlgorithmBase.cs" />
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/IfThenElse.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/IfThenElse.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/IfThenElse.cs	(revision 2202)
@@ -38,8 +38,5 @@
     public IfThenElse()
       : base() {
-      AddConstraint(new NumberOfSubOperatorsConstraint(3, 3));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
-      AddConstraint(new SubOperatorTypeConstraint(2));
+      MinArity = 3; MaxArity = 3;
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/LessThan.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/LessThan.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/LessThan.cs	(revision 2202)
@@ -28,5 +28,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class LessThan : FunctionBase {
+  public sealed class LessThan : BinaryFunction {
     public override string Description {
       get {
@@ -37,7 +37,4 @@
     public LessThan()
       : base() {
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Logarithm.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Logarithm.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Logarithm.cs	(revision 2202)
@@ -29,5 +29,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Logarithm : FunctionBase {
+  public sealed class Logarithm : UnaryFunction {
     public override string Description {
       get { return "Returns the natural (base e) logarithm of the first sub-tree."; }
@@ -36,7 +36,4 @@
     public Logarithm()
       : base() {
-      // must have exactly 1 suboperator
-      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
-      AddConstraint(new SubOperatorTypeConstraint(0));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Multiplication.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Multiplication.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Multiplication.cs	(revision 2202)
@@ -43,8 +43,5 @@
       : base() {
       // 2 - 3 seems like an reasonable defaut (used for +,-,*,/) (discussion with swinkler and maffenze)
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
-      AddConstraint(new SubOperatorTypeConstraint(2));
+      MinArity = 2; MaxArity = 3;
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Not.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Not.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Not.cs	(revision 2202)
@@ -28,5 +28,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Not : FunctionBase {
+  public sealed class Not : UnaryFunction {
     public override string Description {
       get {
@@ -37,6 +37,4 @@
     public Not()
       : base() {
-      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
-      AddConstraint(new SubOperatorTypeConstraint(0));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Or.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Or.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Or.cs	(revision 2202)
@@ -31,6 +31,5 @@
     public override string Description {
       get {
-        return @"Logical OR operation. Only defined for sub-tree-results 0.0 and 1.0.
-Special form, evaluation stops at first sub-tree that evaluates to 1.0 (true).";
+        return @"Logical OR operation. Only defined for sub-tree-results 0.0 and 1.0.";
       }
     }
@@ -38,8 +37,5 @@
     public Or()
       : base() {
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
-      AddConstraint(new SubOperatorTypeConstraint(2));
+      MinArity = 2; MaxArity = 3;
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Power.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Power.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Power.cs	(revision 2202)
@@ -29,5 +29,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Power : FunctionBase {
+  public sealed class Power : BinaryFunction {
     public override string Description {
       get { return "Returns the result of the first sub-tree to the power of the second sub-tree (power(x, y))."; }
@@ -36,8 +36,4 @@
     public Power()
       : base() {
-      // must have exactly 2 suboperators base ^ exponent
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Signum.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Signum.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Signum.cs	(revision 2202)
@@ -29,5 +29,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Signum : FunctionBase {
+  public sealed class Signum : UnaryFunction {
     public override string Description {
       get { return "Returns the signum of the first sub-tree."; }
@@ -36,7 +36,4 @@
     public Signum()
       : base() {
-      // must have exactly 1 suboperator
-      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
-      AddConstraint(new SubOperatorTypeConstraint(0));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Sinus.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Sinus.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Sinus.cs	(revision 2202)
@@ -29,5 +29,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Sinus : FunctionBase {
+  public sealed class Sinus : UnaryFunction {
     public override string Description {
       get { return "Returns the sinus of the first sub-tree."; }
@@ -36,7 +36,4 @@
     public Sinus()
       : base() {
-      // must have exactly 1 suboperator
-      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
-      AddConstraint(new SubOperatorTypeConstraint(0));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Sqrt.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Sqrt.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Sqrt.cs	(revision 2202)
@@ -29,5 +29,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Sqrt : FunctionBase {
+  public sealed class Sqrt : UnaryFunction {
     public override string Description {
       get { return "Returns the square root of the first sub-tree."; }
@@ -36,7 +36,4 @@
     public Sqrt()
       : base() {
-      // must have exactly 1 suboperator
-      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
-      AddConstraint(new SubOperatorTypeConstraint(0));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Subtraction.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Subtraction.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Subtraction.cs	(revision 2202)
@@ -30,5 +30,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Subtraction : FunctionBase {
+  public sealed class Subtraction : BinaryFunction {
     public override string Description {
       get {
@@ -42,9 +42,4 @@
     public Subtraction()
       : base() {
-      // 2 - 3 seems like an reasonable defaut (used for +,-,*,/) (discussion with swinkler and maffenze)
-      //MK changed to only 2 allowed suboperators to be compliant with HL2
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Tangens.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Tangens.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Tangens.cs	(revision 2202)
@@ -29,5 +29,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Tangens : FunctionBase {
+  public sealed class Tangens : UnaryFunction {
     public override string Description {
       get { return "Returns the tangens of the first sub-tree."; }
@@ -36,7 +36,4 @@
     public Tangens()
       : base() {
-      // must have exactly one suboperator
-      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
-      AddConstraint(new SubOperatorTypeConstraint(0));
     }
   }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/TreeEvaluatorBase.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/TreeEvaluatorBase.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/TreeEvaluatorBase.cs	(revision 2202)
@@ -28,4 +28,5 @@
 using System.Diagnostics;
 using HeuristicLab.DataAnalysis;
+using HeuristicLab.Data;
 
 namespace HeuristicLab.GP.StructureIdentification {
@@ -78,11 +79,11 @@
         case EvaluatorSymbolTable.DIFFERENTIAL:
         case EvaluatorSymbolTable.VARIABLE: {
-            instr.i_arg0 = (short)dataset.GetVariableIndex((string)f.localData[0]); // var
-            instr.d_arg0 = (double)f.localData[1]; // weight
-            instr.i_arg1 = (short)(int)f.localData[2]; // sample-offset
+            instr.i_arg0 = (short)dataset.GetVariableIndex((((StringData)f.localData[1].Value).Data)); // var
+            instr.d_arg0 = ((DoubleData)f.localData[0].Value).Data; // weight
+            instr.i_arg1 = (short)((ConstrainedIntData)f.localData[2].Value).Data; // sample-offset
             break;
           }
         case EvaluatorSymbolTable.CONSTANT: {
-            instr.d_arg0 = (double)f.localData[0]; // value
+            instr.d_arg0 = ((DoubleData)f.localData[0].Value).Data; // value
             break;
           }
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Variable.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Variable.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Variable.cs	(revision 2202)
@@ -32,9 +32,10 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public class Variable : FunctionBase {
-
+  public class Variable : Terminal {    
     public const string WEIGHT = "Weight";
     public const string OFFSET = "SampleOffset";
     public const string INDEX = "Variable";
+
+    private BakedFunctionTree variableNodeTemplate;
 
     private int minOffset;
@@ -49,31 +50,35 @@
     }
 
+    public override IEnumerable<string> LocalParameterNames {
+      get {
+        return new string[] { WEIGHT, OFFSET, INDEX };
+      }
+    }
+
+    public override IFunctionTree GetTreeNode() {
+      return (IFunctionTree)variableNodeTemplate.Clone();
+    }
+
     public Variable()
       : base() {
-      AddVariableInfo(new VariableInfo(INDEX, "The variable name", typeof(StringData), VariableKind.None));
-      GetVariableInfo(INDEX).Local = true;
-      AddVariableInfo(new VariableInfo(WEIGHT, "Weight is multiplied to the feature value", typeof(DoubleData), VariableKind.None));
-      GetVariableInfo(WEIGHT).Local = true;
-      AddVariableInfo(new VariableInfo(OFFSET, "SampleOffset is added to the sample index", typeof(ConstrainedIntData), VariableKind.None));
-      GetVariableInfo(OFFSET).Local = true;
-      AddVariableInfo(new VariableInfo(INITIALIZATION, "Initialization operator for variables", typeof(CombinedOperator), VariableKind.None));
-      GetVariableInfo(INITIALIZATION).Local = false;
-      AddVariableInfo(new VariableInfo(MANIPULATION, "Manipulation operator for variables", typeof(CombinedOperator), VariableKind.None));
-      GetVariableInfo(MANIPULATION).Local = false;
+      //AddVariableInfo(new VariableInfo(INDEX, "The variable name", typeof(StringData), VariableKind.None));
+      //GetVariableInfo(INDEX).Local = true;
+      //AddVariableInfo(new VariableInfo(WEIGHT, "Weight is multiplied to the feature value", typeof(DoubleData), VariableKind.None));
+      //GetVariableInfo(WEIGHT).Local = true;
+      //AddVariableInfo(new VariableInfo(OFFSET, "SampleOffset is added to the sample index", typeof(ConstrainedIntData), VariableKind.None));
+      //GetVariableInfo(OFFSET).Local = true;
+      variableNodeTemplate = new BakedFunctionTree(this);
 
       DoubleData weight = new DoubleData();
-      AddVariable(new HeuristicLab.Core.Variable(WEIGHT, weight));
+      variableNodeTemplate.AddVariable(new HeuristicLab.Core.Variable(WEIGHT, weight));
 
       StringData variable = new StringData();
-      AddVariable(new HeuristicLab.Core.Variable(INDEX, variable));
+      variableNodeTemplate.AddVariable(new HeuristicLab.Core.Variable(INDEX, variable));
 
       ConstrainedIntData sampleOffset = new ConstrainedIntData();
-      AddVariable(new HeuristicLab.Core.Variable(OFFSET, sampleOffset));
+      variableNodeTemplate.AddVariable(new HeuristicLab.Core.Variable(OFFSET, sampleOffset));
 
       SetupInitialization();
       SetupManipulation();
-
-      // variable can't have suboperators
-      AddConstraint(new NumberOfSubOperatorsConstraint(0, 0));
     }
 
@@ -104,10 +109,5 @@
       seq.AddSubOperator(weightRandomizer);
       seq.AddSubOperator(offsetRandomizer);
-      HeuristicLab.Core.IVariable initOp = GetVariable(INITIALIZATION);
-      if(initOp == null) {
-        AddVariable(new HeuristicLab.Core.Variable(INITIALIZATION, combinedOp));
-      } else {
-        initOp.Value = combinedOp;
-      }
+      Initializer = combinedOp;
     }
 
@@ -139,14 +139,9 @@
       seq.AddSubOperator(weightRandomAdder);
       seq.AddSubOperator(offsetRandomAdder);
-      HeuristicLab.Core.IVariable manipulationOp = GetVariable(MANIPULATION);
-      if(manipulationOp == null) {
-        AddVariable(new HeuristicLab.Core.Variable(MANIPULATION, combinedOp));
-      } else {
-        manipulationOp.Value = combinedOp;
-      }
+      Manipulator = combinedOp;
     }
 
     public void SetConstraints(int minSampleOffset, int maxSampleOffset) {
-      ConstrainedIntData offset = GetVariableValue<ConstrainedIntData>(OFFSET, null, false);
+      ConstrainedIntData offset = (ConstrainedIntData)variableNodeTemplate.GetLocalVariable(OFFSET).Value;
       IntBoundedConstraint offsetConstraint = new IntBoundedConstraint();
       this.minOffset = minSampleOffset;
Index: branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Xor.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Xor.cs	(revision 2174)
+++ branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Xor.cs	(revision 2202)
@@ -28,5 +28,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public sealed class Xor : FunctionBase {
+  public sealed class Xor : BinaryFunction {
     public override string Description {
       get {
@@ -37,7 +37,4 @@
     public Xor()
       : base() {
-      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
-      AddConstraint(new SubOperatorTypeConstraint(0));
-      AddConstraint(new SubOperatorTypeConstraint(1));
     }
   }
