Index: branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs
===================================================================
--- branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs	(revision 17005)
+++ branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs	(revision 17120)
@@ -42,5 +42,5 @@
     private const string StrictHashingParameterName = "StrictHashing";
 
-    private static readonly Func<byte[], ulong> hashFunction = HashUtil.JSHash;
+    private static readonly Func<byte[], ulong> hashFunction = HashUtil.DJBHash;
 
     #region Parameter Properties
@@ -88,6 +88,5 @@
     }
 
-    public SymbolicDataAnalysisExpressionDiversityPreservingCrossover() {
-      name = "DiversityCrossover";
+    public SymbolicDataAnalysisExpressionDiversityPreservingCrossover() : base() {
       Parameters.Add(new ValueLookupParameter<PercentValue>(InternalCrossoverPointProbabilityParameterName, "The probability to select an internal crossover point (instead of a leaf node).", new PercentValue(0.9)));
       Parameters.Add(new ValueLookupParameter<BoolValue>(WindowingParameterName, "Use proportional sampling with windowing for cutpoint selection.", new BoolValue(false)));
@@ -96,6 +95,5 @@
     }
 
-    private SymbolicDataAnalysisExpressionDiversityPreservingCrossover(SymbolicDataAnalysisExpressionDiversityPreservingCrossover<T> original, Cloner cloner) : base(original, cloner) {
-    }
+    private SymbolicDataAnalysisExpressionDiversityPreservingCrossover(SymbolicDataAnalysisExpressionDiversityPreservingCrossover<T> original, Cloner cloner) : base(original, cloner) { }
 
     public override IDeepCloneable Clone(Cloner cloner) {
Index: branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashExtensions.cs
===================================================================
--- branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashExtensions.cs	(revision 17005)
+++ branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashExtensions.cs	(revision 17120)
@@ -25,4 +25,8 @@
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
   public static class SymbolicExpressionHashExtensions {
+    /// <summary>
+    /// Holds data that is necessary to handle tree nodes in hashing / simplification.
+    /// </summary>
+    /// <typeparam name="T">The tree node type</typeparam>
     public sealed class HashNode<T> : IComparable<HashNode<T>>, IEquatable<HashNode<T>> where T : class {
       public T Data;
@@ -38,13 +42,5 @@
       public SimplifyAction Simplify;
 
-      //public IComparer<T> Comparer;
-
       public bool IsLeaf => Arity == 0;
-
-      //public HashNode(IComparer<T> comparer) {
-      //  Comparer = comparer;
-      //}
-
-      //public HashNode() { }
 
       public int CompareTo(HashNode<T> other) {
@@ -170,8 +166,8 @@
 
     /// <summary>
-    /// Get a function node's child indicest
+    /// Get a function node's child indices
     /// </summary>
     /// <typeparam name="T">The data type encapsulated by a hash node</typeparam>
-    /// <param name="nodes">An array of hash nodes with up-to-date node sizes</param>
+    /// <param name="nodes">An array of hash nodes with up-to-date node sizes (see UpdateNodeSizes)</param>
     /// <param name="i">The index in the array of hash nodes of the node whose children we want to iterate</param>
     /// <returns>An array containing child indices</returns>
@@ -188,4 +184,10 @@
     }
 
+    /// <summary>
+    /// Determines size of each branch and sets the results for each node.
+    /// </summary>
+    /// <typeparam name="T">The data type encapsulated by a hash node</typeparam>
+    /// <param name="nodes">An array of hash nodes in postfix order.</param>
+    /// <returns>The array with updated node sizes. The array is not copied.</returns>
     public static HashNode<T>[] UpdateNodeSizes<T>(this HashNode<T>[] nodes) where T : class {
       for (int i = 0; i < nodes.Length; ++i) {
@@ -196,5 +198,5 @@
         }
         node.Size = node.Arity;
-
+        // visit all children and sum up their size (assumes postfix order).
         for (int j = i - 1, k = 0; k < node.Arity; j -= 1 + nodes[j].Size, ++k) {
           node.Size += nodes[j].Size;
@@ -204,4 +206,5 @@
     }
 
+    // disables duplicate branches and removes the disabled nodes
     public static HashNode<T>[] Reduce<T>(this HashNode<T>[] nodes) where T : class {
       int count = 0;
Index: branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/SymbolicExpressionTreeHash.cs
===================================================================
--- branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/SymbolicExpressionTreeHash.cs	(revision 17005)
+++ branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/SymbolicExpressionTreeHash.cs	(revision 17120)
@@ -48,5 +48,5 @@
       ulong hashFunction(byte[] input) => HashUtil.DJBHash(input);
 
-      var hashNodes = simplify ? node.MakeNodes(strict).Simplify(hashFunction) : node.MakeNodes(strict).Sort(hashFunction);
+      var hashNodes = simplify ? node.MakeNodes(strict).Simplify(hashFunction) : node.MakeNodes(strict).Sort(hashFunction); // simplify sorts implicitly
       var hashes = new ulong[hashNodes.Length];
       for (int i = 0; i < hashes.Length; ++i) {
@@ -210,4 +210,5 @@
       var treeNodes = nodes.Select(x => x.Data.Symbol.CreateTreeNode()).ToArray();
 
+      // construct tree top down (assumes postfix order for nodes)
       for (int i = nodes.Length - 1; i >= 0; --i) {
         var node = nodes[i];
@@ -244,6 +245,6 @@
     // (in other words simplification should be applied in a bottom-up fashion)
     public static ISymbolicExpressionTree Simplify(ISymbolicExpressionTree tree) {
-      ulong hashFunction(byte[] bytes) => HashUtil.JSHash(bytes);
-      var root = tree.Root.GetSubtree(0).GetSubtree(0);
+      ulong hashFunction(byte[] bytes) => HashUtil.DJBHash(bytes);
+      var root = tree.ActualRoot();
       var nodes = root.MakeNodes();
       var simplified = nodes.Simplify(hashFunction);
@@ -369,4 +370,5 @@
         nodes[i].Enabled = false;
       } else if ((parentSymbol is Exponential && childSymbol is Logarithm) || (parentSymbol is Logarithm && childSymbol is Exponential)) {
+        // exp(log(x)) == x only for positive x. We consider this as equivalent for hashing anyway.
         child.Enabled = parent.Enabled = false;
       }
Index: branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
===================================================================
--- branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs	(revision 17005)
+++ branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs	(revision 17120)
@@ -436,5 +436,5 @@
             il.Emit(System.Reflection.Emit.OpCodes.Mul); // x2*x2
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0);
-            il.Emit(System.Reflection.Emit.OpCodes.Mul); // 1+x2*x2
+            il.Emit(System.Reflection.Emit.OpCodes.Add); // 1+x2*x2
             il.Emit(System.Reflection.Emit.OpCodes.Call, sqrt);
             il.Emit(System.Reflection.Emit.OpCodes.Div);
Index: branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Selectors/DiversitySelector.cs
===================================================================
--- branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Selectors/DiversitySelector.cs	(revision 17005)
+++ branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Selectors/DiversitySelector.cs	(revision 17120)
@@ -66,7 +66,13 @@
     }
 
-    public bool StrictSimilarity { get { return StrictSimilarityParameter.Value.Value; } }
-
-    public double SimilarityWeight { get { return SimilarityWeightParameter.Value.Value; } }
+    public bool StrictSimilarity {
+      get { return StrictSimilarityParameter.Value.Value; }
+      set { StrictSimilarityParameter.Value.Value = value; }
+    }
+
+    public double SimilarityWeight {
+      get { return SimilarityWeightParameter.Value.Value; }
+      set { SimilarityWeightParameter.Value.Value = value; }
+    }
 
     public DiversitySelector() : base() {
@@ -74,6 +80,6 @@
       Parameters.Add(new FixedValueParameter<DoubleValue>(SimilarityWeightParameterName, "Weight of the diversity term.", new DoubleValue(1)));
       Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees that should be analyzed."));
-      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(DiversityParameterName));
       Parameters.Add(new ValueParameter<ISingleObjectiveSelector>(SelectorParameterName, "The inner selection operator to select the parents.", new TournamentSelector()));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(DiversityParameterName, "The diversity value calcuated by the operator (output). The inner selector uses this value."));
 
       RegisterParameterEventHandlers();
@@ -81,5 +87,5 @@
 
     [StorableConstructor]
-    private DiversitySelector(StorableConstructorFlag deserializing) : base(deserializing) { }
+    private DiversitySelector(StorableConstructorFlag _) : base(_) { }
 
     private DiversitySelector(DiversitySelector original, Cloner cloner) : base(original, cloner) { }
@@ -91,9 +97,9 @@
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() {
-      RegisterParameterEventHandlers();
-
       if (!Parameters.ContainsKey(DiversityParameterName)) {
         Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(DiversityParameterName));
       }
+
+      RegisterParameterEventHandlers();
     }
 
@@ -103,5 +109,13 @@
       CopySelectedParameter.ValueChanged += CopySelectedParameter_ValueChanged;
       CopySelected.ValueChanged += CopySelected_ValueChanged;
-    }
+
+      MaximizationParameter.NameChanged += MaximizationParameter_NameChanged;
+      QualityParameter.NameChanged += QualityParameter_NameChanged;
+      RandomParameter.NameChanged += RandomParameter_NameChanged;
+    }
+
+    private void RandomParameter_NameChanged(object sender, EventArgs e) { ParameterizeSelector(Selector); }
+    private void QualityParameter_NameChanged(object sender, EventArgs e) { ParameterizeSelector(Selector); }
+    private void MaximizationParameter_NameChanged(object sender, EventArgs e) { ParameterizeSelector(Selector); }
 
     private void CopySelectedParameter_ValueChanged(object sender, EventArgs e) {
@@ -127,5 +141,5 @@
       if (w.IsAlmost(0)) {
         ApplyInnerSelector();
-        return CurrentScope.SubScopes[1].SubScopes.ToArray();
+        return CurrentScope.SubScopes[1].SubScopes.ToArray();  // return selected individuals (selectors create two sub-scopes with remaining and selected)
       }
 
Index: branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
===================================================================
--- branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs	(revision 17005)
+++ branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs	(revision 17120)
@@ -111,5 +111,5 @@
 
     public Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> ComputeBottomUpMapping(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) {
-      return ComputeBottomUpMapping(t1.Root.GetSubtree(0).GetSubtree(0), t2.Root.GetSubtree(0).GetSubtree(0));
+      return ComputeBottomUpMapping(ActualRoot(t1), ActualRoot(t2));
     }
 
