diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs
index 1eff376f..75352192 100644
--- a/SabreTools.Library/DatFiles/DatFile.cs
+++ b/SabreTools.Library/DatFiles/DatFile.cs
@@ -1312,7 +1312,7 @@ namespace SabreTools.Library.DatFiles
}
///
- /// Remove a value from the file dictionary if it exists
+ /// Remove the first instance of a value from the file dictionary if it exists
///
/// Key in the dictionary to remove from
/// Value to remove from the dictionary
@@ -1330,7 +1330,7 @@ namespace SabreTools.Library.DatFiles
lock (_items)
{
// While the key is in the dictionary and the item is there, remove it
- while (_items.ContainsKey(key) && _items[key].Contains(value))
+ if (_items.ContainsKey(key) && _items[key].Contains(value))
{
// Remove the statistics first
_datStats.RemoveItem(value);
@@ -1416,7 +1416,6 @@ namespace SabreTools.Library.DatFiles
// Get the unsorted current list
List roms = this[key];
- bool currentkey = false;
// Now add each of the roms to their respective keys
for (int i = 0; i < roms.Count; i++)
@@ -1429,7 +1428,6 @@ namespace SabreTools.Library.DatFiles
// If the key is different, move the item to the new key
if (newkey != key)
{
- currentkey = true;
Add(newkey, rom);
Remove(key, rom);
i--; // This make sure that the pointer stays on the correct since one was removed