Index: branches/ItemTreeViews/3.3/Plugin.cs
===================================================================
--- branches/ItemTreeViews/3.3/Plugin.cs	(revision 14335)
+++ branches/ItemTreeViews/3.3/Plugin.cs	(revision 14337)
@@ -23,13 +23,13 @@
 
 namespace HeuristicLab.ItemTreeViews.Views {
-  [Plugin("HeuristicLab.ItemTreeViews.Views", "3.3.14.14195")]
+  [Plugin("HeuristicLab.ItemTreeViews.Views", "3.3.14.14335")]
   [PluginFile("HeuristicLab.ItemTreeViews.Views-3.3.dll", PluginFileType.Assembly)]
-  [PluginDependency("HeuristicLab.Collections", "3.3")]
+  [PluginDependency("HeuristicLab.Collections", "3.3")] 
   [PluginDependency("HeuristicLab.Common", "3.3")]
   [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
-  [PluginDependency("HeuristicLab.Core", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")] 
   [PluginDependency("HeuristicLab.Core.Views", "3.3")]
-  [PluginDependency("HeuristicLab.MainForm", "3.3")]
-  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
+  [PluginDependency("HeuristicLab.MainForm", "3.3")] 
+  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]     
   public class Plugin : PluginBase {
   }
Index: branches/ItemTreeViews/3.3/Plugin.cs.frame
===================================================================
--- branches/ItemTreeViews/3.3/Plugin.cs.frame	(revision 14337)
+++ branches/ItemTreeViews/3.3/Plugin.cs.frame	(revision 14337)
@@ -0,0 +1,36 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 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 HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.ItemTreeViews.Views {
+  [Plugin("HeuristicLab.ItemTreeViews.Views", "3.3.14.$WCREV$")]
+  [PluginFile("HeuristicLab.ItemTreeViews.Views-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Collections", "3.3")] 
+  [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")] 
+  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
+  [PluginDependency("HeuristicLab.MainForm", "3.3")] 
+  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]     
+  public class Plugin : PluginBase {
+  }
+}
Index: branches/ItemTreeViews/3.3/Properties/AssemblyInfo.cs
===================================================================
--- branches/ItemTreeViews/3.3/Properties/AssemblyInfo.cs	(revision 14335)
+++ branches/ItemTreeViews/3.3/Properties/AssemblyInfo.cs	(revision 14337)
@@ -21,4 +21,5 @@
 
 using System.Reflection;
+using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -26,5 +27,5 @@
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
-[assembly: AssemblyTitle("HeuristicLab.ItemTreeViews.Views")]
+[assembly: AssemblyTitle("HeuristicLab.Problems.TestFunctions.MultiObjective")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
@@ -54,3 +55,3 @@
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("3.3.0.0")]
-[assembly: AssemblyFileVersion("3.3.14.14195")]
+[assembly: AssemblyFileVersion("3.3.14.14335")]
Index: branches/ItemTreeViews/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- branches/ItemTreeViews/3.3/Properties/AssemblyInfo.cs.frame	(revision 14337)
+++ branches/ItemTreeViews/3.3/Properties/AssemblyInfo.cs.frame	(revision 14337)
@@ -0,0 +1,57 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 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.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Problems.TestFunctions.MultiObjective")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2016 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("c8460c22-cba5-48ad-8283-1284313b2c17")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.14.$WCREV$")]
Index: branches/ItemTreeViews/3.3/Views/ItemCollectionTreeView.cs
===================================================================
--- branches/ItemTreeViews/3.3/Views/ItemCollectionTreeView.cs	(revision 14335)
+++ branches/ItemTreeViews/3.3/Views/ItemCollectionTreeView.cs	(revision 14337)
@@ -62,7 +62,5 @@
       set { showDetailsCheckBox.Checked = value; }
     }
-
     public TreeView ItemsTreeView { get { return itemsTreeView; } }
-
     #endregion
 
@@ -72,5 +70,4 @@
       treeViewChildrenMapping = new Dictionary<T, T>();
     }
-
     protected override void Dispose(bool disposing) {
       if (disposing) {
@@ -82,5 +79,4 @@
 
     #region eventregistration
-
     protected override void DeregisterContentEvents() {
       Content.ItemsAdded -= Content_ItemsAdded;
@@ -89,5 +85,4 @@
       base.DeregisterContentEvents();
     }
-
     protected override void RegisterContentEvents() {
       DeregisterContentEvents(); //prevent multiattaching
@@ -102,5 +97,4 @@
       item.ToStringChanged -= Item_ToStringChanged;
     }
-
     protected virtual void RegisterItemEvents(T item) {
       DeregisterItemEvents(item); //prevent multiattaching
@@ -114,5 +108,4 @@
       ItemsTreeView.KeyDown -= itemsTreeView_KeyDown;
     }
-
     protected virtual void RegisterViewEvents() {
       DeregisterViewEvents(); //prevent multiattaching
@@ -132,5 +125,4 @@
       RegisterViewEvents();
       Caption += " (" + Content.GetType().Name + ")";
-
       foreach (T item in Content)
         AddTreeNodeRecursive(item, null);
@@ -138,5 +130,4 @@
       ItemsTreeView.EndUpdate();
     }
-
     #endregion
 
@@ -159,5 +150,4 @@
       }
     }
-
     protected virtual T CreateItem() {
       if (typeSelectorDialog == null) {
@@ -177,5 +167,4 @@
       return null;
     }
-
     protected virtual TreeNode CreateTreeViewNode(T item) {
       var treeViewNode = new TreeNode("noName");
@@ -197,14 +186,14 @@
     }
 
-    #region recursive adding
-
+    #region adding
     protected virtual void AddTreeNode(T item) {
-      if (item != null && !itemTreeViewItemMapping.ContainsKey(item) && treeViewChildrenMapping.ContainsKey(item)) { //create TreeNode if not exists
-        RegisterItemEvents(item);
-        var node = CreateTreeViewNode(item);
-        itemTreeViewItemMapping[item] = node;
-        var p = GetParent(item);
-        (p == null ? ItemsTreeView.Nodes : itemTreeViewItemMapping[p].Nodes).Add(node);
-      }
+      if (item == null || itemTreeViewItemMapping.ContainsKey(item) || !treeViewChildrenMapping.ContainsKey(item))
+        return;
+      RegisterItemEvents(item);
+      var node = CreateTreeViewNode(item);
+      itemTreeViewItemMapping[item] = node;
+      var p = GetParent(item);
+      (p == null ? ItemsTreeView.Nodes : itemTreeViewItemMapping[p].Nodes).Add(node);
+
 
     }
@@ -214,24 +203,18 @@
       queue.Enqueue(item);
       if (!treeViewChildrenMapping.ContainsKey(item))
-        treeViewChildrenMapping.Add(item, parent != null ? parent.Tag as T : null); //Set explicitly to null in some cases. who cares??
+        treeViewChildrenMapping.Add(item, parent != null ? parent.Tag as T : null); //Set explicitly to null in some cases
       while (queue.Count > 0 && (item = queue.Dequeue()) != null) {
         AddTreeNode(item);
         foreach (var child in ExpandTreeViewItem(item)) { //Expand queue
-          if (!treeViewChildrenMapping.ContainsKey(child)) {
+          if (!treeViewChildrenMapping.ContainsKey(child))
             treeViewChildrenMapping.Add(child, item);
-          }
           queue.Enqueue(child);
         }
       }
     }
-
-
     protected void UpdateTreeNodeRecursive(T item, TreeNode parent) {
       if (item == null) return;
       Queue<T> queue = new Queue<T>();
       queue.Enqueue(item);
-      //parent relation has to exist by now
-      //if (!treeViewChildrenMapping.ContainsKey(item))
-      //treeViewChildrenMapping.Add(item, parent != null ? parent.Tag as T : null); //Set explicitly to null in some cases. who cares??
       while (queue.Count > 0 && (item = queue.Dequeue()) != null) {
         AddTreeNode(item);
@@ -244,7 +227,6 @@
 
         foreach (var child in newChildren) { //Expand queue
-          if (!treeViewChildrenMapping.ContainsKey(child)) {
+          if (!treeViewChildrenMapping.ContainsKey(child))
             treeViewChildrenMapping.Add(child, item);
-          }
           queue.Enqueue(child);
         }
@@ -255,6 +237,4 @@
       }
     }
-
-
 
     /// <summary>
@@ -277,6 +257,6 @@
     #endregion
 
-    #region recursive removal 
-    protected virtual void RemoveTreeViewItem(TreeNode treeViewItem) {
+    #region removal 
+    private void RemoveTreeViewItem2(TreeNode treeViewItem) {
       if (treeViewItem == null) return;
       T item = treeViewItem.Tag as T;
@@ -291,6 +271,24 @@
           RemoveTreeViewItem(itemTreeViewItemMapping[node]);
       treeViewItem.Remove();
-
-    }
+    }
+
+    protected void RemoveTreeViewItem(TreeNode treeViewNode) {
+      var queue = new Queue<TreeNode>(new[] { treeViewNode });
+      treeViewNode.Remove();
+      while (queue.Count > 0) {
+        treeViewNode = queue.Dequeue();
+        T item = treeViewNode.Tag as T;
+        if (item != null) {
+          treeViewChildrenMapping.Remove(item);
+          itemTreeViewItemMapping.Remove(item);
+          DeregisterItemEvents(item);
+        }
+        var children = GetChildren(item);
+        foreach (var node in children)
+          if (node != null && itemTreeViewItemMapping.ContainsKey(node)) queue.Enqueue(itemTreeViewItemMapping[node]);
+      }
+    }
+    #endregion
+
     protected virtual void UpdateTreeViewItemImage(TreeNode treeViewNode) {
       if (treeViewNode == null) throw new ArgumentNullException();
@@ -298,11 +296,10 @@
       var i = treeViewNode.ImageIndex;
       ItemsTreeView.ImageList.Images[i] = item == null ? Common.Resources.VSImageLibrary.Nothing : item.ItemImage;
-      treeViewNode.ImageIndex = -1;
+      treeViewNode.ImageIndex = i;
       treeViewNode.SelectedImageIndex = treeViewNode.ImageIndex;
-      treeViewNode.ImageIndex = i;
     }
     protected virtual void UpdateTreeViewItemText(TreeNode treeViewNode) {
       if (treeViewNode == null) throw new ArgumentNullException();
-      T item = treeViewNode.Tag as T;
+      var item = treeViewNode.Tag as T;
       treeViewNode.Text = item == null ? "null" : item.ToString();
       treeViewNode.ToolTipText = item == null ? string.Empty : item.ItemName + ": " + item.ItemDescription;
@@ -314,26 +311,22 @@
       itemTreeViewItemMapping.TryGetValue(item, out viewItem);
       return viewItem;
-
-    }
-    #endregion
+    }
 
     #region View Events
     protected virtual void itemsTreeView_SelectedIndexChanged(object sender, EventArgs e) {
       removeButton.Enabled = (Content != null) && !Content.IsReadOnly && !ReadOnly && ItemsTreeView.SelectedNode != null;
-      if (showDetailsCheckBox.Checked) {
-        var item = ItemsTreeView.SelectedNode != null ? ItemsTreeView.SelectedNode.Tag as T : null;
-        detailsGroupBox.Enabled = true;
-        viewHost.Content = item;
-      }
+      if (!showDetailsCheckBox.Checked) return;
+      var item = ItemsTreeView.SelectedNode != null ? ItemsTreeView.SelectedNode.Tag as T : null;
+      detailsGroupBox.Enabled = true;
+      viewHost.Content = item;
     }
     protected virtual void itemsTreeView_KeyDown(object sender, KeyEventArgs e) {
       if (e.KeyCode == Keys.Delete) {
         if ((ItemsTreeView.SelectedNode != null) && !Content.IsReadOnly && !ReadOnly) {
-          //no multiselction but recursive deletion
           var selected = GetAllNodes(ItemsTreeView.SelectedNode);
           if (ItemCollection != null) ItemCollection.RemoveRange(selected.Select(i => (T)i.Tag));
           else {
             ItemsTreeView.BeginUpdate();
-            foreach (TreeNode item in selected) { Content.Remove((T)item.Tag); }
+            foreach (var item in selected) Content.Remove((T)item.Tag);
             ItemsTreeView.EndUpdate();
           }
@@ -354,12 +347,10 @@
     protected virtual void addButton_Click(object sender, EventArgs e) {
       T item = CreateItem();
-      if (item != null)
-        Content.Add(item);
+      if (item != null) Content.Add(item);
     }
     protected virtual void sortAscendingButton_Click(object sender, EventArgs e) {
       SortItemsTreeView();
     }
-    protected virtual void sortDescendingButton_Click(object sender, EventArgs e) {
-      //DO nothing for Treeview (no custom sort order)
+    protected virtual void sortDescendingButton_Click(object sender, EventArgs e) { //DO nothing for Treeview (no custom sort order possible) 
     }
     protected virtual void removeButton_Click(object sender, EventArgs e) {
@@ -395,7 +386,5 @@
       else {
         ItemsTreeView.BeginUpdate();
-        foreach (T item in e.Items) {
-          AddTreeNodeRecursive(item, null);
-        }
+        foreach (T item in e.Items) AddTreeNodeRecursive(item, null);
         RebuildTreeImageList();
         ItemsTreeView.EndUpdate();
@@ -409,8 +398,6 @@
         ItemsTreeView.BeginUpdate();
         foreach (T item in e.Items) {
-          //remove only the first matching ViewItem, because the IItem could be contained multiple times in the ItemCollection
           var treeNode = GetTreeNodeForItem(item);
           if (treeNode != null) RemoveTreeViewItem(treeNode);
-
         }
         RebuildTreeImageList();
@@ -424,5 +411,4 @@
         ItemsTreeView.BeginUpdate();
         foreach (T item in e.OldItems) {
-          //remove only the first matching ViewItem, because the IItem could be contained multiple times in the ItemCollection
           var treeNode = GetTreeNodeForItem(item);
           if (treeNode != null) RemoveTreeViewItem(treeNode);
@@ -441,8 +427,6 @@
         Invoke(new EventHandler(Item_ItemImageChanged), sender, e);
       else {
-        var item = sender as T;
-        var node = GetTreeNodeForItem(item);
-        if (node != null) { UpdateTreeViewItemImage(node); }
-
+        var node = GetTreeNodeForItem(sender as T);
+        if (node != null) UpdateTreeViewItemImage(node);
       }
     }
@@ -455,9 +439,5 @@
         if (itemNode == null) return; //nothing to remove
         var parent = itemNode.Parent;
-        //update Node
         ItemsTreeView.BeginUpdate();
-        //        if (itemNode.Nodes.Count > 0)
-        //          RemoveTreeViewItem(itemNode);
-        //        AddTreeNodeRecursive(item, parent);
         UpdateTreeNodeRecursive(item, parent);
         UpdateTreeViewItemText(itemNode);
@@ -468,10 +448,8 @@
 
     #region Helpers
-    // no sortOrder in TreeView
     protected virtual void SortItemsTreeView() {
       ItemsTreeView.Sort();
       ItemsTreeView.Sorted = true;
     }
-    // recursive image list rebuilding
     protected virtual void RebuildTreeImageList() {
       if (ItemsTreeView.ImageList == null) ItemsTreeView.ImageList = new ImageList();
@@ -502,16 +480,14 @@
     }
     private static void AddAllNodes(List<TreeNode> list, TreeNode node) {
-      if (list.Contains(node)) return;
-      list.Add(node);
-      foreach (TreeNode n in node.Nodes) {
-        AddAllNodes(list, n);
-      }
-    }
-
+      var queue = new Queue<TreeNode>(new[] { node });
+      while (queue.Count > 0) {
+        node = queue.Dequeue();
+        if (!list.Contains(node)) list.Add(node);
+        foreach (TreeNode n in node.Nodes)
+          queue.Enqueue(n);
+      }
+    }
     protected T GetParent(T child) {
       return treeViewChildrenMapping.ContainsKey(child) ? treeViewChildrenMapping[child] : null;
-    }
-    protected TreeNode GetParent(TreeNode child) {
-      return child.Parent;
     }
     private static IItem GetValue(object parent) {
@@ -522,5 +498,4 @@
             try { return prop.GetValue(parent) as IItem; }
             catch (TargetInvocationException) { }  //if getting the value is not an option (LookUpParameters,...) try other properties
-
           }
         }
@@ -528,16 +503,7 @@
       return null;
     }
-
     protected List<T> GetChildren(T parent) {
       return treeViewChildrenMapping.Where(x => x.Value == parent).Select(x => x.Key).ToList();
     }
-    private int CountAllNodes(TreeNode n) {
-      var nodes = n != null ? n.Nodes : null ?? ItemsTreeView.Nodes;
-      var res = 1;
-      foreach (var node in nodes.Cast<TreeNode>()) {
-        res += CountAllNodes(node);
-      }
-      return res;
-    }
     #endregion
   }
