diff --git a/Nodify/Editor/NodifyEditor.Selecting.cs b/Nodify/Editor/NodifyEditor.Selecting.cs
index d92a7cf2..ffd53e87 100644
--- a/Nodify/Editor/NodifyEditor.Selecting.cs
+++ b/Nodify/Editor/NodifyEditor.Selecting.cs
@@ -362,7 +362,6 @@ public void BeginSelecting(Point location, SelectionType type = SelectionType.Re
                 return;
             }
 
-            UnselectAllConnections();
             SelectedArea = _selection.Start(ItemContainers, location, type, EnableRealtimeSelection);
             IsSelecting = true;
         }
@@ -398,6 +397,11 @@ public void EndSelecting()
                 return;
             }
 
+            if (_selection.Type == SelectionType.Replace)
+            {
+                UnselectAllConnections();
+            }
+
             SelectedArea = _selection.End();
             ApplyPreviewingSelection();
             IsSelecting = false;
@@ -418,7 +422,7 @@ public void CancelSelecting()
 
             if (IsSelecting)
             {
-                ClearPreviewingSelection();
+                _selection.Cancel();
                 IsSelecting = false;
             }
         }
@@ -445,16 +449,6 @@ private void ApplyPreviewingSelection()
             EndUpdateSelectedItems();
         }
 
-        private void ClearPreviewingSelection()
-        {
-            ItemCollection items = Items;
-            for (var i = 0; i < items.Count; i++)
-            {
-                var container = (ItemContainer)ItemContainerGenerator.ContainerFromIndex(i);
-                container.IsPreviewingSelection = null;
-            }
-        }
-
         #endregion
 
         #region Selection Handlers
diff --git a/Nodify/Utilities/SelectionHelper.cs b/Nodify/Utilities/SelectionHelper.cs
index b9cecc8b..02a611de 100644
--- a/Nodify/Utilities/SelectionHelper.cs
+++ b/Nodify/Utilities/SelectionHelper.cs
@@ -14,12 +14,13 @@ internal sealed class SelectionHelper
     {
         private Point _startLocation;
         private Point _endLocation;
-        private SelectionType _selectionType;
         private bool _isRealtime;
-        private IReadOnlyCollection<ItemContainer> _items = Array.Empty<ItemContainer>();
+        private IReadOnlyList<ItemContainer> _items = Array.Empty<ItemContainer>();
         private IReadOnlyList<ItemContainer> _initialSelection = Array.Empty<ItemContainer>();
         private Rect _selectedArea;
 
+        public SelectionType Type { get; private set; }
+
         /// <summary>Attempts to start a new selection.</summary>
         /// <param name="containers">The containers that can be part of the selection.</param>
         /// <param name="location">The location inside the graph.</param>
@@ -30,7 +31,7 @@ public Rect Start(IEnumerable<ItemContainer> containers, Point location, Selecti
             _items = containers.Where(x => x.IsSelectable).ToList();
             _initialSelection = containers.Where(x => x.IsSelected).ToList();
 
-            _selectionType = selectionType;
+            Type = selectionType;
 
             _isRealtime = realtime;
             _startLocation = location;
@@ -79,9 +80,18 @@ public Rect End()
             return _selectedArea;
         }
 
+        public void Cancel()
+        {
+            ClearPreviewingSelection();
+            _items = Array.Empty<ItemContainer>();
+            _initialSelection = Array.Empty<ItemContainer>();
+        }
+
+        #region Selection preview
+
         private void PreviewSelection(Rect area)
         {
-            switch (_selectionType)
+            switch (Type)
             {
                 case SelectionType.Replace:
                     PreviewSelectArea(area);
@@ -114,9 +124,9 @@ private void PreviewSelection(Rect area)
 
         private void PreviewUnselectAll()
         {
-            foreach (var container in _items)
+            for (int i = 0; i < _items.Count; i++)
             {
-                container.IsPreviewingSelection = false;
+                _items[i].IsPreviewingSelection = false;
             }
         }
 
@@ -129,8 +139,9 @@ private void PreviewSelectArea(Rect area, bool append = false, bool fit = false)
 
             if (area.X != 0 || area.Y != 0 || area.Width > 0 || area.Height > 0)
             {
-                foreach (var container in _items)
+                for (int i = 0; i < _items.Count; i++)
                 {
+                    ItemContainer? container = _items[i];
                     if (container.IsSelectableInArea(area, fit))
                     {
                         container.IsPreviewingSelection = true;
@@ -141,8 +152,9 @@ private void PreviewSelectArea(Rect area, bool append = false, bool fit = false)
 
         private void PreviewUnselectArea(Rect area, bool fit = false)
         {
-            foreach (var container in _items)
+            for (int i = 0; i < _items.Count; i++)
             {
+                ItemContainer? container = _items[i];
                 if (container.IsSelectableInArea(area, fit))
                 {
                     container.IsPreviewingSelection = false;
@@ -152,7 +164,7 @@ private void PreviewUnselectArea(Rect area, bool fit = false)
 
         private static void PreviewSelectContainers(IReadOnlyList<ItemContainer> containers)
         {
-            for (var i = 0; i < containers.Count; i++)
+            for (int i = 0; i < containers.Count; i++)
             {
                 containers[i].IsPreviewingSelection = true;
             }
@@ -160,14 +172,25 @@ private static void PreviewSelectContainers(IReadOnlyList<ItemContainer> contain
 
         private void PreviewInvertSelection(Rect area, bool fit = false)
         {
-            foreach (var container in _items)
+            for (int i = 0; i < _items.Count; i++)
             {
+                ItemContainer? container = _items[i];
                 if (container.IsSelectableInArea(area, fit))
                 {
                     container.IsPreviewingSelection = !container.IsPreviewingSelection;
                 }
             }
         }
+
+        private void ClearPreviewingSelection()
+        {
+            for (int i = 0; i < _items.Count; i++)
+            {
+                _items[i].IsPreviewingSelection = null;
+            }
+        }
+
+        #endregion
     }
 
     internal static class SelectionGesturesExtensions