Quantcast

optimizing codebase (stage 1)

failcoder [08-24-15 - 21:24]
optimizing codebase (stage 1)
Filename
SVUI_!Core/filtering/defaults.lua
SVUI_!Core/libs/_Librarian/Librarian.lua
SVUI_!Core/libs/_SVUI_Lib/Animate.lua
SVUI_!Core/libs/_SVUI_Lib/Events.lua
SVUI_!Core/libs/_SVUI_Lib/External.lua
SVUI_!Core/libs/_SVUI_Lib/LUA.lua
SVUI_!Core/libs/_SVUI_Lib/Linguist.lua
SVUI_!Core/libs/_SVUI_Lib/Parser.lua
SVUI_!Core/libs/_SVUI_Lib/Registry.lua
SVUI_!Core/libs/_SVUI_Lib/Sounds.lua
SVUI_!Core/libs/_SVUI_Lib/SpecialFX.lua
SVUI_!Core/libs/_SVUI_Lib/Timers.lua
SVUI_!Core/setup/installer.lua
SVUI_!Core/setup/presets.lua
SVUI_!Core/setup/theme_select.lua
SVUI_!Core/system/_docklets/breakstuff.lua
SVUI_!Core/system/_docklets/garrison.lua
SVUI_!Core/system/_docklets/misc.lua
SVUI_!Core/system/_docklets/profession.lua
SVUI_!Core/system/_reports/bags.lua
SVUI_!Core/system/_reports/cta.lua
SVUI_!Core/system/_reports/dps.lua
SVUI_!Core/system/_reports/durability.lua
SVUI_!Core/system/_reports/experience.lua
SVUI_!Core/system/_reports/friends.lua
SVUI_!Core/system/_reports/gold.lua
SVUI_!Core/system/_reports/guild.lua
SVUI_!Core/system/_reports/hps.lua
SVUI_!Core/system/_reports/reputation.lua
SVUI_!Core/system/_reports/system.lua
SVUI_!Core/system/_reports/template.lua
SVUI_!Core/system/_reports/time.lua
SVUI_!Core/system/_reports/tokens.lua
SVUI_!Core/system/api.lua
SVUI_!Core/system/automations.lua
SVUI_!Core/system/core.lua
SVUI_!Core/system/dock.lua
SVUI_!Core/system/dropdown.lua
SVUI_!Core/system/gear.lua
SVUI_!Core/system/henchmen.lua
SVUI_!Core/system/letsride.lua
SVUI_!Core/system/mail.lua
SVUI_!Core/system/overrides.lua
SVUI_!Core/system/profile.lua
SVUI_!Core/system/reports.lua
SVUI_!Core/system/utilities.lua
SVUI_!Options/SVUI_!Options.lua
SVUI_!Options/UnitFrames.lua
SVUI_ActionBars/SVUI_ActionBars.lua
SVUI_ActionBars/components/totem.lua
SVUI_Auras/SVUI_Auras.lua
SVUI_Auras/components/procs.lua
SVUI_Chat/SVUI_Chat.lua
SVUI_FightOMatic/SVUI_FightOMatic.lua
SVUI_Inventory/components/organization.lua
SVUI_Inventory/components/sorting.lua
diff --git a/SVUI_!Core/filtering/defaults.lua b/SVUI_!Core/filtering/defaults.lua
index 54f5c82..a7cbbc6 100644
--- a/SVUI_!Core/filtering/defaults.lua
+++ b/SVUI_!Core/filtering/defaults.lua
@@ -8,7 +8,6 @@ GET ADDON DATA
 ##########################################################
 ]]--
 local _G = _G;
-local unpack            = _G.unpack;
 local select            = _G.select;
 local assert            = _G.assert;
 local type              = _G.type;
diff --git a/SVUI_!Core/libs/_Librarian/Librarian.lua b/SVUI_!Core/libs/_Librarian/Librarian.lua
index 1b0deab..6c31fc7 100644
--- a/SVUI_!Core/libs/_Librarian/Librarian.lua
+++ b/SVUI_!Core/libs/_Librarian/Librarian.lua
@@ -6,10 +6,10 @@ It's main purpose is to keep all methods and logic needed to properly keep
 core add-ins functioning outside of the core object.

 It is also modifyiing LibStub to give me dominating control over which libraries are
-allowed to be created and loaded regardless of versioning or timing.
+allowed to be created and loaded regardless of versioning or timing.

 The reasoning for this is due to the potential for other addon to get loaded earlier
-and embed newer versions of lib dependencies which can be devastating.
+and embed newer versions of lib dependencies which can be devastating.
 --]]
 local _G            = getfenv(0)
 local select        = _G.select;
@@ -30,7 +30,6 @@ local xpcall        = _G.xpcall;
 local table         = _G.table;
 local tconcat       = table.concat;
 local tremove       = table.remove;
-local tinsert       = table.insert;
 local strmatch      = _G.strmatch;
 local table_sort    = table.sort;
 local bit           = _G.bit;
@@ -51,13 +50,13 @@ if not Librarian then
     Librarian = { libs = {} };

     _G.Librarian = Librarian;
-
+
     function Librarian:NewLibrary(libName)
         assert(type(libName) == "string", "Missing Library Name")
         self.libs[libName] = self.libs[libName] or {}
         return self.libs[libName]
     end
-
+
     function Librarian:Fetch(libName, silent)
         if not self.libs[libName] and not silent then
             error(("Cannot find a library instance of %q."):format(tostring(libName)), 2)
@@ -74,14 +73,14 @@ local dead = function() return end
 if not LibStub then
     LibStub         = {libs = {}, minors = {}};
     _G.LibStub      = LibStub;
-
+
     function LibStub:GetLibrary(major, silent)
         if not self.libs[major] and not silent then
             error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
         end
         return self.libs[major], self.minors[major]
     end
-
+
     function LibStub:IterateLibraries() return pairs(self.libs) end
     setmetatable(LibStub, { __call = LibStub.GetLibrary })
 end
@@ -147,4 +146,4 @@ LibStub.locked      = {};
 LibStub.NewLibrary  = LibStubNew;
 LibStub.Kill        = LibStubKill;
 LibStub.Lock        = LibStubLock;
-LibStub.Unlock      = LibStubUnlock;
\ No newline at end of file
+LibStub.Unlock      = LibStubUnlock;
diff --git a/SVUI_!Core/libs/_SVUI_Lib/Animate.lua b/SVUI_!Core/libs/_SVUI_Lib/Animate.lua
index 1801d5a..8b2e14f 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Animate.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Animate.lua
@@ -1,7 +1,7 @@
 --[[
-  /$$$$$$            /$$                           /$$
- /$$__  $$          |__/                          | $$
-| $$  \ $$ /$$$$$$$  /$$ /$$$$$$/$$$$   /$$$$$$  /$$$$$$    /$$$$$$
+  /$$$$$$            /$$                           /$$
+ /$$__  $$          |__/                          | $$
+| $$  \ $$ /$$$$$$$  /$$ /$$$$$$/$$$$   /$$$$$$  /$$$$$$    /$$$$$$
 | $$$$$$$$| $$__  $$| $$| $$_  $$_  $$ |____  $$|_  $$_/   /$$__  $$
 | $$__  $$| $$  \ $$| $$| $$ \ $$ \ $$  /$$$$$$$  | $$    | $$$$$$$$
 | $$  | $$| $$  | $$| $$| $$ | $$ | $$ /$$__  $$  | $$ /$$| $$_____/
@@ -13,7 +13,6 @@
 --GLOBAL NAMESPACE
 local _G = getfenv(0);
 --LUA
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
@@ -47,15 +46,15 @@ local MANAGED_ANIMATIONS = {
 --[[ LOCAL FUNCTIONS ]]--

 local Anim_OnShow = function(self)
-    if self.anim:IsPlaying() then
+    if self.anim:IsPlaying() then
         self.anim:Finish()
     end
     self.anim:Play()
-end
+end

 local Anim_OnHide = function(self)
     self.anim:Finish()
-end
+end

 local Anim_OnPlay = function(self)
     local parent = self.parent
@@ -63,7 +62,7 @@ local Anim_OnPlay = function(self)
     if self.hideOnFinished and not parent:IsShown() then
         parent:Show()
     end
-end
+end

 local Anim_OnStop = function(self)
     local parent = self.parent
@@ -77,7 +76,7 @@ local Anim_OnStop = function(self)
         parent:SetScale(1)
         self.startscale = 1
     end
-end
+end

 local Anim_OnFinished = function(self)
     local parent = self.parent
@@ -86,7 +85,7 @@ local Anim_OnFinished = function(self)
     if(looped and looped == "REPEAT" and parent:IsShown()) then
         self:Play()
     end
-end
+end

 local Sprite4_OnUpdate = function(self)
     local order = self:GetOrder()
@@ -99,11 +98,11 @@ local Sprite4_OnUpdate = function(self)
     left = (order - 1) * 0.25;
     right = left + 0.25;
     parent:SetTexCoord(left,right,0,1)
-    if parent.overlay then
+    if parent.overlay then
         parent.overlay:SetTexCoord(left,right,0,1)
         parent.overlay:SetVertexColor(1,1,1,FlickerAlpha[order])
     end
-end
+end

 local Sprite8_OnUpdate = function(self)
     local order = self:GetOrder()
@@ -116,10 +115,10 @@ local Sprite8_OnUpdate = function(self)
     left = (order - 1) * 0.125;
     right = left + 0.125;
     parent:SetTexCoord(left,right,0,1)
-    if parent.overlay then
+    if parent.overlay then
         parent.overlay:SetTexCoord(left,right,0,1)
         parent.overlay:SetVertexColor(1,1,1,FlickerAlpha[order])
-    end
+    end
 end

 local Pulse_OnPlay = function(self)
@@ -132,13 +131,13 @@ local Pulse_OnUpdate1 = function(self)
     local parent = self.parent
     local step = self:GetProgress()
     parent:SetScale(1 + (1.05 * step))
-end
+end

 local Pulse_OnUpdate2 = function(self)
     local parent = self.parent
     local step = self:GetProgress()
     parent:SetScale(1 + (1.05 * (1 - step)))
-end
+end

 local Kapow_OnUpdate1 = function(self)
     local parent = self.parent
@@ -171,18 +170,18 @@ local Slide_OnUpdate = function(self)
     local parent = self.parent
     local step = self:GetProgress()
     parent:SetScale(1 + (1.05 * step))
-end
+end

 local Slide_OnPlay = function(self)
     local parent = self.parent
     parent:SetScale(0.01)
     parent:SetAlpha(1)
-end
+end

 local Slide_FadeStart = function(self)
     local parent = self.parent
     UIFrameFadeOut(parent, 0.3, 1, 0)
-end
+end

 local Slide_FadeStop = function(self)
     self.parent:SetAlpha(0)
@@ -199,7 +198,7 @@ end
 --[[ LIB METHODS ]]--

 local function AnimationTemplate(frame, animType, hideOnFinished, speed, special, scriptToParent, noShowHide)
-    if(not frame or not animType) then return end
+    if(not frame or not animType) then return end

     frame.anim = frame:CreateAnimationGroup(animType)
     frame.anim.parent = frame;
@@ -231,28 +230,28 @@ local function AnimationTemplate(frame, animType, hideOnFinished, speed, special

     if(animType == 'Flash') then
         frame.anim.fadeOnFinished = true
-        if not speed then speed = 0.33 end
+        if not speed then speed = 0.33 end

         frame.anim[1] = SetNewAnimation(frame.anim, "Alpha")
         frame.anim[1]:SetChange(1)
         frame.anim[1]:SetOrder(2)
         frame.anim[1]:SetDuration(speed)
-
+
         frame.anim[2] = SetNewAnimation(frame.anim, "Alpha")
         frame.anim[2]:SetChange(-1)
         frame.anim[2]:SetOrder(1)
         frame.anim[2]:SetDuration(speed)

-        if special then
+        if special then
             frame.anim:SetLooping("REPEAT")
         end
     elseif(animType == 'Orbit') then
         frame.anim[1] = SetNewAnimation(frame.anim, "Rotation")
-        if special then
+        if special then
             frame.anim[1]:SetDegrees(-360)
-        else
+        else
             frame.anim[1]:SetDegrees(360)
-        end
+        end
         frame.anim[1]:SetDuration(speed)
         frame.anim:SetLooping("REPEAT")
         frame.anim:Play()
@@ -277,13 +276,13 @@ local function AnimationTemplate(frame, animType, hideOnFinished, speed, special
         frame.anim[4]:SetDuration(speed)
         frame.anim[4]:SetScript("OnUpdate", Sprite4_OnUpdate)

-        if special then
+        if special then
             frame.anim[5] = SetNewAnimation(frame.anim, "Translation")
             frame.anim[5]:SetOrder(5)
             frame.anim[5]:SetDuration(special)
             frame.anim[5].isFadeFrame = true;
             frame.anim[5]:SetScript("OnUpdate", Sprite4_OnUpdate)
-        end
+        end
         if(not hideOnFinished) then
             frame.anim:SetLooping("REPEAT")
         end
@@ -302,39 +301,39 @@ local function AnimationTemplate(frame, animType, hideOnFinished, speed, special
         frame.anim[3]:SetOrder(3)
         frame.anim[3]:SetDuration(speed)
         frame.anim[3]:SetScript("OnUpdate", Sprite8_OnUpdate)
-
+
         frame.anim[4] = SetNewAnimation(frame.anim, "Translation")
         frame.anim[4]:SetOrder(4)
         frame.anim[4]:SetDuration(speed)
         frame.anim[4]:SetScript("OnUpdate", Sprite8_OnUpdate)
-
+
         frame.anim[5] = SetNewAnimation(frame.anim, "Translation")
         frame.anim[5]:SetOrder(5)
         frame.anim[5]:SetDuration(speed)
         frame.anim[5]:SetScript("OnUpdate", Sprite8_OnUpdate)
-
+
         frame.anim[6] = SetNewAnimation(frame.anim, "Translation")
         frame.anim[6]:SetOrder(6)
         frame.anim[6]:SetDuration(speed)
         frame.anim[6]:SetScript("OnUpdate", Sprite8_OnUpdate)
-
+
         frame.anim[7] = SetNewAnimation(frame.anim, "Translation")
         frame.anim[7]:SetOrder(7)
         frame.anim[7]:SetDuration(speed)
         frame.anim[7]:SetScript("OnUpdate", Sprite8_OnUpdate)
-
+
         frame.anim[8] = SetNewAnimation(frame.anim, "Translation")
         frame.anim[8]:SetOrder(8)
         frame.anim[8]:SetDuration(speed)
         frame.anim[8]:SetScript("OnUpdate", Sprite8_OnUpdate)

-        if(special) then
+        if(special) then
             frame.anim[9] = SetNewAnimation(frame.anim, "Translation")
             frame.anim[9]:SetOrder(9)
             frame.anim[9]:SetDuration(special)
             frame.anim[9].isFadeFrame = true;
             frame.anim[9]:SetScript("OnUpdate", Sprite4_OnUpdate)
-        end
+        end

         if(not hideOnFinished) then
             frame.anim:SetLooping("REPEAT")
@@ -371,44 +370,44 @@ local function AnimationTemplate(frame, animType, hideOnFinished, speed, special
         else
             frame.anim[2]:SetScript("OnUpdate", Kapow_OnUpdate2Special)
         end
-    end
+    end
 end

 --[[ ROTATE AND WOBBLE (kinda like twerking i guess...) ]]--

 function lib:Orbit(frame, speed, reversed, hideOnFinished)
-    if not frame then return end
-    if not speed then speed = 1 end
+    if not frame then return end
+    if not speed then speed = 1 end
     AnimationTemplate(frame, 'Orbit', hideOnFinished, speed, reversed)
-end
+end

 function lib:Pulse(frame, hideOnFinished)
-    if not frame then return end
-    AnimationTemplate(frame, 'Pulse', hideOnFinished)
+    if not frame then return end
+    AnimationTemplate(frame, 'Pulse', hideOnFinished)
 end

 function lib:Kapow(frame, hideOnFinished, noShowHide, noHide)
-    if not frame then return end
-    AnimationTemplate(frame, 'Kapow', hideOnFinished, nil, noHide, nil, noShowHide)
+    if not frame then return end
+    AnimationTemplate(frame, 'Kapow', hideOnFinished, nil, noHide, nil, noShowHide)
 end

 --[[ ANIMATED SPRITES ]]--

 function lib:Sprite4(frame, speed, fadeTime, scriptToParent)
-    if not frame then return end
+    if not frame then return end
     speed = speed or 0.08;
     AnimationTemplate(frame, 'Sprite4', false, speed, fadeTime, scriptToParent)
-end
+end

 function lib:Sprite8(frame, speed, fadeTime, scriptToParent, hideOnFinished)
-    if not frame then return end
+    if not frame then return end
     speed = speed or 0.08;
-    AnimationTemplate(frame, 'Sprite8', hideOnFinished, speed, fadeTime, scriptToParent)
-end
+    AnimationTemplate(frame, 'Sprite8', hideOnFinished, speed, fadeTime, scriptToParent)
+end

 function lib:StopSprite(frame)
-    if not frame then return end
-    frame.anim:Finish()
+    if not frame then return end
+    frame.anim:Finish()
 end

 --[[ FLASHING ]]--
@@ -419,19 +418,19 @@ function lib:Flash(frame, speed, looped)
     end
     if not frame.anim:IsPlaying() then
         frame.anim:Play()
-    end
-end
+    end
+end

 function lib:StopFlash(frame)
     if not frame.anim then return end
     frame.anim:Finish()
-    frame.anim:Stop()
-end
+    frame.anim:Stop()
+end

 --[[ SLIDING ]]--

 function lib:Slide(frame, xDirection, yDirection, bounce, extendedTime)
-    if(not frame or (frame and frame.anim)) then return end
+    if(not frame or (frame and frame.anim)) then return end

     frame.anim = frame:CreateAnimationGroup("Slide")
     frame.anim.hideOnFinished = true;
@@ -443,7 +442,7 @@ function lib:Slide(frame, xDirection, yDirection, bounce, extendedTime)
     frame.anim[1] = SetNewAnimation(frame.anim, "Translation")
     frame.anim[1]:SetDuration(0)
     frame.anim[1]:SetOrder(1)
-
+
     frame.anim[2] = SetNewAnimation(frame.anim, "Translation")
     frame.anim[2]:SetDuration(0.3)
     frame.anim[2]:SetOrder(2)
@@ -460,15 +459,15 @@ function lib:Slide(frame, xDirection, yDirection, bounce, extendedTime)
         frame.anim[4]:SetSmoothing("IN")
         frame.anim[4]:SetOffset(xDirection, yDirection)
     end
-end
+end

 function lib:RandomSlide(frame, raised)
-    if not frame then return end
-    if raised then
+    if not frame then return end
+    if raised then
         frame:SetFrameLevel(30)
-    else
+    else
         frame:SetFrameLevel(20)
-    end
+    end
     frame:SetPoint("CENTER", UIParent, "CENTER", 0, -150)

     frame.anim = frame:CreateAnimationGroup("RandomSlide")
@@ -491,16 +490,16 @@ function lib:RandomSlide(frame, raised)
     frame.anim[3]:SetScript("OnStop", Slide_FadeStop)

     frame.anim:SetScript("OnFinished", Slide_FadeStop)
-end
+end

 function lib:SlideIn(frame)
-    if not frame.anim then return end
+    if not frame.anim then return end
     frame:Show()
     frame.anim:Play()
-end
+end

 function lib:SlideOut(frame)
-    if not frame.anim then return end
+    if not frame.anim then return end
     frame.anim:Finish()
     frame.anim:Stop()
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/libs/_SVUI_Lib/Events.lua b/SVUI_!Core/libs/_SVUI_Lib/Events.lua
index 1a1409b..8e68cf2 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Events.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Events.lua
@@ -13,7 +13,6 @@
 --GLOBAL NAMESPACE
 local _G = getfenv(0);
 --LUA
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
@@ -43,7 +42,6 @@ local floor         = math.floor
 local table         = _G.table;
 local tsort         = table.sort;
 local tconcat       = table.concat;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local twipe         = _G.wipe;

diff --git a/SVUI_!Core/libs/_SVUI_Lib/External.lua b/SVUI_!Core/libs/_SVUI_Lib/External.lua
index 6a51154..440bcbd 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/External.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/External.lua
@@ -30,7 +30,6 @@ local xpcall          = _G.xpcall;
 local table           = _G.table;
 local tconcat         = table.concat;
 local tremove         = table.remove;
-local tinsert         = table.insert;
 local strmatch        = _G.strmatch;
 local table_sort      = table.sort;
 local bit             = _G.bit;
diff --git a/SVUI_!Core/libs/_SVUI_Lib/LUA.lua b/SVUI_!Core/libs/_SVUI_Lib/LUA.lua
index df74685..70e082d 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/LUA.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/LUA.lua
@@ -165,10 +165,12 @@ function string.decode(data)
 end

 function string.explode(data, delim)
-    local pattern = format("([^%s]+)", delim)
-    local res = {}
+    local pattern = format("([^%s]+)", delim);
+    local res = {};
+		local count = 1;
     for line in gmatch(data, pattern) do
-        tinsert(res, line)
+				res[count] = line;
+				count = count + 1;
     end
     return res
 end
diff --git a/SVUI_!Core/libs/_SVUI_Lib/Linguist.lua b/SVUI_!Core/libs/_SVUI_Lib/Linguist.lua
index c87153d..2f60782 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Linguist.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Linguist.lua
@@ -1,24 +1,23 @@
 --[[
- /$$       /$$                               /$$            /$$
-| $$      |__/                              |__/           | $$
-| $$       /$$ /$$$$$$$   /$$$$$$  /$$   /$$ /$$  /$$$$$$$/$$$$$$
-| $$      | $$| $$__  $$ /$$__  $$| $$  | $$| $$ /$$_____/_  $$_/
-| $$      | $$| $$  \ $$| $$  \ $$| $$  | $$| $$|  $$$$$$  | $$
+ /$$       /$$                               /$$            /$$
+| $$      |__/                              |__/           | $$
+| $$       /$$ /$$$$$$$   /$$$$$$  /$$   /$$ /$$  /$$$$$$$/$$$$$$
+| $$      | $$| $$__  $$ /$$__  $$| $$  | $$| $$ /$$_____/_  $$_/
+| $$      | $$| $$  \ $$| $$  \ $$| $$  | $$| $$|  $$$$$$  | $$
 | $$      | $$| $$  | $$| $$  | $$| $$  | $$| $$ \____  $$ | $$ /$$
 | $$$$$$$$| $$| $$  | $$|  $$$$$$$|  $$$$$$/| $$ /$$$$$$$/ |  $$$$/
-|________/|__/|__/  |__/ \____  $$ \______/ |__/|_______/   \___/
-                         /$$  \ $$
-                        |  $$$$$$/
-                        \______/
+|________/|__/|__/  |__/ \____  $$ \______/ |__/|_______/   \___/
+                         /$$  \ $$
+                        |  $$$$$$/
+                        \______/

-Linguist is a simple localization component. Seriously, thats it!
+Linguist is a simple localization component. Seriously, thats it!
 --]]

 --[[ LOCALIZED GLOBALS ]]--
 --GLOBAL NAMESPACE
 local _G = getfenv(0);
 --LUA
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local rawset        = _G.rawset;
@@ -83,4 +82,4 @@ function lib:Lang(locale, isDefault)
             return metawrite
         end
     end
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/libs/_SVUI_Lib/Parser.lua b/SVUI_!Core/libs/_SVUI_Lib/Parser.lua
index 2045127..70dfb58 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Parser.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Parser.lua
@@ -16,7 +16,6 @@
 --GLOBAL NAMESPACE
 local _G = getfenv(0);
 --LUA
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
@@ -47,7 +46,6 @@ local floor         = math.floor
 local table         = _G.table;
 local tsort         = table.sort;
 local tconcat       = table.concat;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local wipe          = _G.wipe;
 local bit_band      = bit.band;
diff --git a/SVUI_!Core/libs/_SVUI_Lib/Registry.lua b/SVUI_!Core/libs/_SVUI_Lib/Registry.lua
index 7c61247..bfc59c6 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Registry.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Registry.lua
@@ -22,7 +22,6 @@ core add-ins functioning outside of the core object.
 --GLOBAL NAMESPACE
 local _G = getfenv(0);
 --LUA
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
@@ -50,7 +49,6 @@ local math          = _G.math;
 local floor         = math.floor
 --TABLE
 local table         = _G.table;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local wipe          = _G.wipe;

@@ -164,7 +162,7 @@ local function sharedcopy(d, s)
       for k, v in pairs(s) do
           local saved = rawget(d, k)
           if(type(v) == "table") then
-              if(saved == nil) then
+              if(saved == nil) then
                 rawset(d, k, {})
                 sharedcopy(d[k], v)
               elseif(type(saved) == "table") then
@@ -1114,7 +1112,8 @@ local Core_HandleError = function(self, schema, action, catch)
     action = action or "Unknown Function"
     local timestamp = date("%m/%d/%y %H:%M:%S")
     local err_message = (debugPattern):format(schema, action, timestamp, catch)
-    tinsert(self.ERRORLOG, err_message)
+    local count = #self.ERRORLOG + 1;
+    self.ERRORLOG[count] = err_message;
     if(self.DebugMode == true) then
         self.HasErrors = true;
         --self:Debugger(err_message)
@@ -1232,7 +1231,7 @@ function lib:Launch()
                         if(not PRIVATE_SV.SAFEDATA.SAVED[schema]) then
                             PRIVATE_SV.SAFEDATA.SAVED[schema] = true;
                         end
-
+
                         obj.private = InitExternalDB(files.PRIVATE);
                         obj.public = InitExternalDB(files.PUBLIC);
                     end
diff --git a/SVUI_!Core/libs/_SVUI_Lib/Sounds.lua b/SVUI_!Core/libs/_SVUI_Lib/Sounds.lua
index e2f83cf..a2220d5 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Sounds.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Sounds.lua
@@ -1,19 +1,18 @@
 --[[
-  /$$$$$$                                      /$$
- /$$__  $$                                    | $$
+  /$$$$$$                                      /$$
+ /$$__  $$                                    | $$
 | $$  \__/  /$$$$$$  /$$   /$$ /$$$$$$$   /$$$$$$$  /$$$$$$$
 |  $$$$$$  /$$__  $$| $$  | $$| $$__  $$ /$$__  $$ /$$_____/
- \____  $$| $$  \ $$| $$  | $$| $$  \ $$| $$  | $$|  $$$$$$
+ \____  $$| $$  \ $$| $$  | $$| $$  \ $$| $$  | $$|  $$$$$$
  /$$  \ $$| $$  | $$| $$  | $$| $$  | $$| $$  | $$ \____  $$
 |  $$$$$$/|  $$$$$$/|  $$$$$$/| $$  | $$|  $$$$$$$ /$$$$$$$/
- \______/  \______/  \______/ |__/  |__/ \_______/|_______/
+ \______/  \______/  \______/ |__/  |__/ \_______/|_______/
 --]]

 --[[ LOCALIZED GLOBALS ]]--
 --GLOBAL NAMESPACE
 local _G = getfenv(0);
 --LUA
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
@@ -44,7 +43,6 @@ local floor         = math.floor
 local table         = _G.table;
 local tsort         = table.sort;
 local tconcat       = table.concat;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local twipe         = _G.wipe;

@@ -58,7 +56,7 @@ if not lib then return end -- No upgrade needed

 --[[ DUMMY FALLBACK ]]--

-local BLANK_FOLEY = function()
+local BLANK_FOLEY = function()
     return;
 end;

@@ -85,7 +83,8 @@ lib.Blends = {};
 function lib:Register(soundType, soundFile)
     soundType = soundType:lower();
     if(not self.Master[soundType]) then self.Master[soundType] = {} end;
-    tinsert(self.Master[soundType], soundFile);
+    local count = #self.Master + 1;
+    self.Master[soundType][count] = soundFile;
 end;

 --[[ BLENDED SOUND EFFECTS ]]--
@@ -107,7 +106,7 @@ function lib:Blend(blendName, ...)
         self.Blends[blendName] = {};
         self.Blends[blendName].Bank = {};

-        local numChannels = select('#', ...)
+        local numChannels = select('#', ...)

         for i = 1, numChannels do
             local soundType = select(i, ...)
@@ -166,4 +165,4 @@ function lib:Effect(effectName)
     else
         return BLANK_FOLEY
     end
-end;
\ No newline at end of file
+end;
diff --git a/SVUI_!Core/libs/_SVUI_Lib/SpecialFX.lua b/SVUI_!Core/libs/_SVUI_Lib/SpecialFX.lua
index ca16b16..d82f20e 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/SpecialFX.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/SpecialFX.lua
@@ -16,7 +16,6 @@
 --GLOBAL NAMESPACE
 local _G = getfenv(0);
 --LUA
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
@@ -47,7 +46,6 @@ local floor         = math.floor
 local table         = _G.table;
 local tsort         = table.sort;
 local tconcat       = table.concat;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local twipe         = _G.wipe;

diff --git a/SVUI_!Core/libs/_SVUI_Lib/Timers.lua b/SVUI_!Core/libs/_SVUI_Lib/Timers.lua
index 39c72d5..ac9ce61 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Timers.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Timers.lua
@@ -1,19 +1,18 @@
 --[[
- /$$$$$$$$/$$
-|__  $$__/__/
+ /$$$$$$$$/$$
+|__  $$__/__/
    | $$   /$$ /$$$$$$/$$$$   /$$$$$$   /$$$$$$  /$$$$$$$
    | $$  | $$| $$_  $$_  $$ /$$__  $$ /$$__  $$/$$_____/
-   | $$  | $$| $$ \ $$ \ $$| $$$$$$$$| $$  \__/  $$$$$$
+   | $$  | $$| $$ \ $$ \ $$| $$$$$$$$| $$  \__/  $$$$$$
    | $$  | $$| $$ | $$ | $$| $$_____/| $$      \____  $$
    | $$  | $$| $$ | $$ | $$|  $$$$$$$| $$      /$$$$$$$/
-   |__/  |__/|__/ |__/ |__/ \_______/|__/     |_______/
+   |__/  |__/|__/ |__/ |__/ \_______/|__/     |_______/
 --]]

 --[[ LOCALIZED GLOBALS ]]--
 --GLOBAL NAMESPACE
 local _G = getfenv(0);
 --LUA
-local unpack        = _G.unpack;
 local select        = _G.select;
 local type          = _G.type;
 local pairs         = _G.pairs;
@@ -22,7 +21,6 @@ local rawset        = _G.rawset;
 local rawget        = _G.rawget;
 local getmetatable  = _G.getmetatable;
 local setmetatable  = _G.setmetatable;
-local tinsert       = _G.tinsert;
 local string        = _G.string;
 local math          = _G.math;
 local table         = _G.table;
@@ -94,15 +92,15 @@ function lib:ExecuteTimer(timeOutFunction, duration, idCheck)
             TimerQueue[id] = {t = duration, f = timeOutFunction}
             return id
         end
-    end
-    return false
+    end
+    return false
 end

 function lib:RemoveTimer(id)
-    if(TimerQueue[id]) then
+    if(TimerQueue[id]) then
         TimerQueue[id] = nil
         TimerCount = TimerCount - 1;
-    end
+    end
 end

 function lib:ExecuteLoop(timeOutFunction, duration, idCheck)
@@ -117,15 +115,15 @@ function lib:ExecuteLoop(timeOutFunction, duration, idCheck)
             TimerQueue[id] = {x = duration, t = duration, f = timeOutFunction}
             return id
         end
-    end
+    end
     return false
-end
+end

 function lib:RemoveLoop(id)
-    if(TimerQueue[id]) then
+    if(TimerQueue[id]) then
         TimerQueue[id] = nil
         TimerCount = TimerCount - 1;
-    end
+    end
 end

 function lib:ClearAllTimers()
@@ -139,4 +137,4 @@ function lib:Initialize()
     self.Handler:RegisterEvent('PLAYER_REGEN_DISABLED')
     self.Handler:SetScript("OnEvent", Timers_EventHandler)
     self.Handler:SetScript("OnUpdate", ExeTimerManager_OnUpdate)
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/setup/installer.lua b/SVUI_!Core/setup/installer.lua
index ff7da30..2067db9 100644
--- a/SVUI_!Core/setup/installer.lua
+++ b/SVUI_!Core/setup/installer.lua
@@ -7,7 +7,6 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
diff --git a/SVUI_!Core/setup/presets.lua b/SVUI_!Core/setup/presets.lua
index 90f7866..fa37f46 100644
--- a/SVUI_!Core/setup/presets.lua
+++ b/SVUI_!Core/setup/presets.lua
@@ -7,7 +7,6 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
diff --git a/SVUI_!Core/setup/theme_select.lua b/SVUI_!Core/setup/theme_select.lua
index 940b48a..ea7910a 100644
--- a/SVUI_!Core/setup/theme_select.lua
+++ b/SVUI_!Core/setup/theme_select.lua
@@ -1,13 +1,12 @@
 --[[
 ##########################################################
 S V U I   By: Munglunch
-##########################################################
+##########################################################
 LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
@@ -25,8 +24,8 @@ local string 	= _G.string;
 local table     = _G.table;
 local format = string.format;
 local tcopy = table.copy;
---[[
-##########################################################
+--[[
+##########################################################
 GET ADDON DATA
 ##########################################################
 ]]--
@@ -35,7 +34,7 @@ local SVUILib = Librarian("Registry");
 local L = SV.L;

 function SV.Setup:SelectTheme()
-	if not SVUI_ThemeSelectFrame then
+	if not SVUI_ThemeSelectFrame then
 		local frame = CreateFrame("Button", "SVUI_ThemeSelectFrame", UIParent)
 		frame:SetSize(350, 145)
 		frame:SetStyle("Frame", "Window2")
@@ -67,7 +66,7 @@ function SV.Setup:SelectTheme()
 			themeButton.text:SetText(themeName .. " Theme")
 			themeButton.text:SetTextColor(0.1, 0.5, 1)
 			themeButton:EnableMouse(true)
-			themeButton:SetScript("OnMouseDown", function(self)
+			themeButton:SetScript("OnMouseDown", function(self)
 				SVUILib:SaveSafeData("THEME", themeName)
 				SV:StaticPopup_Show("RL_CLIENT");
 			end)
@@ -94,4 +93,4 @@ function SV.Setup:SelectTheme()
 		SVUI_ThemeSelectFrame:Hide()
 		SV:AddonMessage("You do not have any themes installed")
 	end
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/system/_docklets/breakstuff.lua b/SVUI_!Core/system/_docklets/breakstuff.lua
index c591c4f..0da0347 100644
--- a/SVUI_!Core/system/_docklets/breakstuff.lua
+++ b/SVUI_!Core/system/_docklets/breakstuff.lua
@@ -1,7 +1,7 @@
 --[[
 ##########################################################
 S V U I   By: Munglunch
-##########################################################
+##########################################################
 LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
@@ -12,7 +12,6 @@ local select  = _G.select;
 local pairs   = _G.pairs;
 local ipairs  = _G.ipairs;
 local print   = _G.print;
-local tinsert = _G.tinsert;
 local table   = _G.table;
 local match   = string.match;
 --[[ TABLE METHODS ]]--
@@ -37,16 +36,16 @@ local GetMouseFocus  				= _G.GetMouseFocus;
 local GetContainerItemLink  		= _G.GetContainerItemLink;
 local AutoCastShine_AutoCastStart  	= _G.AutoCastShine_AutoCastStart;
 local AutoCastShine_AutoCastStop  	= _G.AutoCastShine_AutoCastStop;
---[[
-##########################################################
+--[[
+##########################################################
 GET ADDON DATA
 ##########################################################
 ]]--
 local SV = select(2, ...)
 local L = SV.L;
 local MOD = SV.Dock;
---[[
-##########################################################
+--[[
+##########################################################
 LOCAL VARS
 ##########################################################
 ]]--
@@ -67,8 +66,8 @@ BreakStuffHandler.TipLines = {}
 BreakStuffHandler.TTextLeft = ""
 BreakStuffHandler.TTextRight = ""
 BreakStuffHandler.ReadyToSmash = false;
---[[
-##########################################################
+--[[
+##########################################################
 ITEM PARSING
 ##########################################################
 ]]--
@@ -182,8 +181,8 @@ do
 		end
 	end
 end
---[[
-##########################################################
+--[[
+##########################################################
 BUILD FOR PACKAGE
 ##########################################################
 ]]--
@@ -198,7 +197,7 @@ local BreakStuff_OnModifier = function(self, arg)
 		self:Hide()
 		AutoCastShine_AutoCastStop(self)
 	end
-end
+end

 BreakStuffHandler.MODIFIER_STATE_CHANGED = BreakStuff_OnModifier;

@@ -212,10 +211,10 @@ local BreakStuff_OnEnter = function(self)
 	GameTooltip:ClearLines()
 	GameTooltip:AddLine(self.ttText)
 	GameTooltip:AddLine(self.subText)
-	if self.ttText2 then
+	if self.ttText2 then
 		GameTooltip:AddLine(' ')
 		GameTooltip:AddDoubleLine(self.ttText2,self.ttText2desc,1,1,1)
-	end
+	end
 	if BreakStuffHandler.ReadyToSmash ~= true then
 		self:SetPanelColor("class")
 		self.icon:SetGradient(unpack(SV.media.gradient.highlight))
@@ -291,7 +290,8 @@ local function LoadToolBreakStuff()
 		spellName,_ = GetSpellInfo(51005)
 		BreakStuff_Cache[ITEM_MILLABLE] = {spellName, 0.5, 1, 0.5}
 		BreakStuff_Cache['OVERRIDE_MILLABLE'] = {spellName, 0.5, 1, 0.5}
-		tinsert(spellListing, spellName)
+    local count = #spellListing + 1;
+    spellListing[count] = spellName;
 	end

 	if(IsSpellKnown(31252)) then
@@ -300,28 +300,32 @@ local function LoadToolBreakStuff()
 		spellName,_ = GetSpellInfo(31252)
 		BreakStuff_Cache[ITEM_PROSPECTABLE] = {spellName, 1, 0.33, 0.33}
 		-- BreakStuff_Cache['OVERRIDE_PROSPECTABLE'] = {spellName, 1, 0.33, 0.33}
-		tinsert(spellListing, spellName)
+    local count = #spellListing + 1;
+    spellListing[count] = spellName;
 	end

 	if(IsSpellKnown(13262)) then
 		--print("Enchanting")
 		allowed = true
 		DE,_ = GetSpellInfo(13262)
-		tinsert(spellListing, DE)
+    local count = #spellListing + 1;
+    spellListing[count] = DE;
 	end

 	if(IsSpellKnown(1804)) then
 		--print("Lockpicking")
 		allowed = true
 		PICK,_ = GetSpellInfo(1804)
-		tinsert(spellListing, PICK)
+    local count = #spellListing + 1;
+    spellListing[count] = PICK;
 	end

 	if(IsSpellKnown(2018)) then
 		--print("Blacksmithing")
 		allowed = true
 		SMITH,_ = GetSpellBookItemInfo((GetSpellInfo(2018)))
-		tinsert(spellListing, SMITH)
+    local count = #spellListing + 1;
+    spellListing[count] = SMITH;
 	end

 	MOD.BreakStuffLoaded = true;
@@ -334,8 +338,8 @@ local function LoadToolBreakStuff()
 	BreakStuffButton:SetPoint("RIGHT", MOD.BottomRight.Bar.ToolBar, "LEFT", -6, 0)
 	BreakStuffButton.icon:SetTexture(SV.media.dock.breakStuffIcon)
 	BreakStuffButton:Show();
-	BreakStuffButton:SetStyle("DockButton")
-
+	BreakStuffButton:SetStyle("DockButton")
+
 	BreakStuffButton:SetScript("OnEnter", BreakStuff_OnEnter);
 	BreakStuffButton:SetScript("OnLeave", BreakStuff_OnLeave);
 	BreakStuffButton:SetScript("OnClick", BreakStuff_OnClick);
@@ -369,4 +373,4 @@ end
 function MOD:LoadBreakStuff()
 	if((not SV.db.Dock.dockTools.breakstuff) or self.BreakStuffLoaded) then return end
 	SV.Timers:ExecuteTimer(LoadToolBreakStuff, 5)
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/system/_docklets/garrison.lua b/SVUI_!Core/system/_docklets/garrison.lua
index 6335624..a03dc38 100644
--- a/SVUI_!Core/system/_docklets/garrison.lua
+++ b/SVUI_!Core/system/_docklets/garrison.lua
@@ -7,7 +7,6 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
@@ -28,7 +27,6 @@ local match         = string.match;
 local gsub          = string.gsub;
 --TABLE
 local table 				= _G.table;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local twipe 				= _G.wipe;
 --MATH
diff --git a/SVUI_!Core/system/_docklets/misc.lua b/SVUI_!Core/system/_docklets/misc.lua
index ebe362d..70e5638 100644
--- a/SVUI_!Core/system/_docklets/misc.lua
+++ b/SVUI_!Core/system/_docklets/misc.lua
@@ -7,7 +7,6 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
diff --git a/SVUI_!Core/system/_docklets/profession.lua b/SVUI_!Core/system/_docklets/profession.lua
index d28d21f..517dfe7 100644
--- a/SVUI_!Core/system/_docklets/profession.lua
+++ b/SVUI_!Core/system/_docklets/profession.lua
@@ -7,7 +7,6 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack        = _G.unpack;
 local select        = _G.select;
 local assert        = _G.assert;
 local type          = _G.type;
@@ -28,7 +27,6 @@ local match         = string.match;
 local gsub          = string.gsub;
 --TABLE
 local table 		= _G.table;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local twipe 		= _G.wipe;
 --MATH
diff --git a/SVUI_!Core/system/_reports/bags.lua b/SVUI_!Core/system/_reports/bags.lua
index f6f7106..2853f49 100644
--- a/SVUI_!Core/system/_reports/bags.lua
+++ b/SVUI_!Core/system/_reports/bags.lua
@@ -3,13 +3,13 @@
 S V U I   By: Munglunch
 ##############################################################################

-##########################################################
+##########################################################
 LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local pairs 	= _G.pairs;
 local ipairs 	= _G.ipairs;
@@ -19,7 +19,6 @@ local pcall 	= _G.pcall;
 local assert 	= _G.assert;
 local tostring 	= _G.tostring;
 local tonumber 	= _G.tonumber;
-local tinsert 	= _G.tinsert;
 local string 	= _G.string;
 local math 		= _G.math;
 local table 	= _G.table;
@@ -40,16 +39,16 @@ local GetContainerNumSlots      = _G.GetContainerNumSlots;
 local ToggleAllBags     		= _G.ToggleAllBags;
 local MAX_WATCHED_TOKENS        = _G.MAX_WATCHED_TOKENS;
 local GetBackpackCurrencyInfo  = _G.GetBackpackCurrencyInfo;
---[[
-##########################################################
+--[[
+##########################################################
 GET ADDON DATA
 ##########################################################
 ]]--
 local SV = select(2, ...)
 local L = SV.L
 local Reports = SV.Reports;
---[[
-##########################################################
+--[[
+##########################################################
 BAG STATS
 ##########################################################
 ]]--
@@ -66,10 +65,10 @@ Report.events = {"PLAYER_ENTERING_WORLD", "BAG_UPDATE"};

 Report.OnEvent = function(self, event, ...)
 	local f, g, h = 0, 0, 0;
-	for i = 0, NUM_BAG_SLOTS do
+	for i = 0, NUM_BAG_SLOTS do
 		f, g = f + GetContainerNumFreeSlots(i),
 		g + GetContainerNumSlots(i)
-	end
+	end
 	h = g - f;
 	self.text:SetFormattedText(bags_text, L["Bags"]..": ", hexColor, h, g)
 end
@@ -80,15 +79,15 @@ end

 Report.OnEnter = function(self)
 	Reports:SetDataTip(self)
-	for i = 1, MAX_WATCHED_TOKENS do
+	for i = 1, MAX_WATCHED_TOKENS do
 		local l, m, n, o, p = GetBackpackCurrencyInfo(i)
-		if l and i == 1 then
+		if l and i == 1 then
 			Reports.ToolTip:AddLine(CURRENCY)
 			Reports.ToolTip:AddLine(" ")
-		end
-		if l and m then
+		end
+		if l and m then
 			Reports.ToolTip:AddDoubleLine(l, m, 1, 1, 1)
-		end
-	end
+		end
+	end
 	Reports:ShowDataTip()
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/system/_reports/cta.lua b/SVUI_!Core/system/_reports/cta.lua
index c36f520..aeeb363 100644
--- a/SVUI_!Core/system/_reports/cta.lua
+++ b/SVUI_!Core/system/_reports/cta.lua
@@ -3,13 +3,13 @@
 S V U I   By: Munglunch
 ##############################################################################

-##########################################################
+##########################################################
 LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local pairs 	= _G.pairs;
 local ipairs 	= _G.ipairs;
@@ -19,7 +19,6 @@ local pcall 	= _G.pcall;
 local assert 	= _G.assert;
 local tostring 	= _G.tostring;
 local tonumber 	= _G.tonumber;
-local tinsert 	= _G.tinsert;
 local string 	= _G.string;
 local math 		= _G.math;
 local table 	= _G.table;
@@ -32,16 +31,16 @@ local gmatch, gsub = string.gmatch, string.gsub;
 local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round;  -- Basic
 --[[ TABLE METHODS ]]--
 local twipe, tsort = table.wipe, table.sort;
---[[
-##########################################################
+--[[
+##########################################################
 GET ADDON DATA
 ##########################################################
 ]]--
 local SV = select(2, ...)
 local L = SV.L
 local Reports = SV.Reports;
---[[
-##########################################################
+--[[
+##########################################################
 CALL TO ARMS STATS
 ##########################################################
 ]]--
@@ -51,15 +50,15 @@ local TEXT_PATTERN = ("%s: N/A"):format(BATTLEGROUND_HOLIDAY);
 local TEXT_FORMATTING = function(tanks, heals, dps)
 	local result = ""
 	if tanks then
-		result = result.."|TInterface\\AddOns\\SVUI_!Core\\assets\\textures\\default\\tank.tga:14:14|t"
-	end
+		result = result.."|TInterface\\AddOns\\SVUI_!Core\\assets\\textures\\default\\tank.tga:14:14|t"
+	end
 	if heals then
-		result = result.."|TInterface\\AddOns\\SVUI_!Core\\assets\\textures\\default\\healer.tga:14:14|t"
-	end
+		result = result.."|TInterface\\AddOns\\SVUI_!Core\\assets\\textures\\default\\healer.tga:14:14|t"
+	end
 	if dps then
-		result = result.."|TInterface\\AddOns\\SVUI_!Core\\assets\\textures\\default\\dps.tga:14:14|t"
-	end
-	return result
+		result = result.."|TInterface\\AddOns\\SVUI_!Core\\assets\\textures\\default\\dps.tga:14:14|t"
+	end
+	return result
 end

 local Report = Reports:NewReport(REPORT_NAME, {
@@ -75,24 +74,24 @@ Report.OnEvent = function(self, event, ...)
 	local isHeal = false;
 	local isDPS = false;
 	local isNormal = true;
-	for r = 1, GetNumRandomDungeons()do
+	for r = 1, GetNumRandomDungeons()do
 		local id, name = GetLFGRandomDungeonInfo(r)
 		for i = 1, LFG_ROLE_NUM_SHORTAGE_TYPES do
 			local eligible, forTank, forHealer, forDamage, itemCount = GetLFGRoleShortageRewards(id, i)
 			if eligible then
-				isNormal = false
-			end
+				isNormal = false
+			end
 			if eligible and forTank and itemCount > 0 then
 				isTank = true;
-			end
+			end
 			if eligible and forHealer and itemCount > 0 then
 				isHeal = true;
-			end
+			end
 			if eligible and forDamage and itemCount > 0 then
 				isDPS = true;
 			end
-		end
-	end
+		end
+	end
 	if isNormal then
 		self.text:SetText(TEXT_PATTERN)
 	else
@@ -116,27 +115,27 @@ Report.OnEnter = function(self)
 		for i = 1, LFG_ROLE_NUM_SHORTAGE_TYPES do
 			local eligible, forTank, forHealer, forDamage, itemCount = GetLFGRoleShortageRewards(id, i)
 			if eligible then
-				isNormal = false
-			end
+				isNormal = false
+			end
 			if eligible and forTank and itemCount > 0 then
 				isTank = true;
-			end
+			end
 			if eligible and forHealer and itemCount > 0 then
 				isHeal = true;
-			end
+			end
 			if eligible and forDamage and itemCount > 0 then
 				isDPS = true;
-			end
+			end
 		end
 		if not isNormal then
 			local text = TEXT_FORMATTING(isTank, isHeal, isDPS)
 			if text ~= "" then
 				Reports.ToolTip:AddDoubleLine(name..":", text, 1, 1, 1)
-			end
+			end
 			if isTank or isHeal or isDPS then
-				counter = counter + 1
-			end
+				counter = counter + 1
+			end
 		end
 	end
 	Reports:ShowDataTip()
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/system/_reports/dps.lua b/SVUI_!Core/system/_reports/dps.lua
index 4e9f990..cddb143 100644
--- a/SVUI_!Core/system/_reports/dps.lua
+++ b/SVUI_!Core/system/_reports/dps.lua
@@ -9,7 +9,7 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local string 	= _G.string;
 --[[ STRING METHODS ]]--
diff --git a/SVUI_!Core/system/_reports/durability.lua b/SVUI_!Core/system/_reports/durability.lua
index 24c9e4d..99353b8 100644
--- a/SVUI_!Core/system/_reports/durability.lua
+++ b/SVUI_!Core/system/_reports/durability.lua
@@ -3,13 +3,13 @@
 S V U I   By: Munglunch
 ##############################################################################

-##########################################################
+##########################################################
 LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local pairs 	= _G.pairs;
 local ipairs 	= _G.ipairs;
@@ -19,7 +19,6 @@ local pcall 	= _G.pcall;
 local assert 	= _G.assert;
 local tostring 	= _G.tostring;
 local tonumber 	= _G.tonumber;
-local tinsert 	= _G.tinsert;
 local string 	= _G.string;
 local math 		= _G.math;
 local table 	= _G.table;
@@ -36,8 +35,8 @@ local ToggleCharacter      			= _G.ToggleCharacter;
 local GetInventoryItemDurability    = _G.GetInventoryItemDurability;
 local GetInventorySlotInfo  		= _G.GetInventorySlotInfo;
 local DURABILITY  					= _G.DURABILITY;
---[[
-##########################################################
+--[[
+##########################################################
 GET ADDON DATA
 ##########################################################
 ]]--
@@ -45,8 +44,8 @@ local SV = select(2, ...)
 local L = SV.L
 local LSM = _G.LibStub("LibSharedMedia-3.0")
 local Reports = SV.Reports;
---[[
-##########################################################
+--[[
+##########################################################
 DURABILITY STATS
 ##########################################################
 ]]--
@@ -68,8 +67,8 @@ local inventoryMap = {
 }
 local HEX_COLOR = "22FFFF";
 local TEXT_PATTERN = "|cff%s%s|r";
---[[
-##########################################################
+--[[
+##########################################################
 STANDARD TYPE
 ##########################################################
 ]]--
@@ -88,17 +87,17 @@ Report.OnEvent = function(self, event, ...)
 		self.text:SetAllPoints(self)
 		self.text:SetJustifyH("CENTER")
 		self.barframe:Hide()
-	end
-	for slot,name in pairs(inventoryMap)do
+	end
+	for slot,name in pairs(inventoryMap)do
 		local slotID = GetInventorySlotInfo(slot)
 		min,max = GetInventoryItemDurability(slotID)
 		if min then
 			equipment[name] = min / max * 100;
 			if min / max * 100 < overall then
-				overall = min / max * 100
-			end
-		end
-	end
+				overall = min / max * 100
+			end
+		end
+	end
 	self.text:SetFormattedText(displayString, DURABILITY, HEX_COLOR, overall)
 end

@@ -110,11 +109,11 @@ Report.OnEnter = function(self)
 	Reports:SetDataTip(self)
 	for name,amt in pairs(equipment)do
 		Reports.ToolTip:AddDoubleLine(name, format("%d%%", amt),1, 1, 1, SV:ColorGradient(amt * 0.01, 1, 0, 0, 1, 1, 0, 0, 1, 0))
-	end
+	end
 	Reports:ShowDataTip()
 end
---[[
-##########################################################
+--[[
+##########################################################
 BAR TYPE
 ##########################################################
 ]]--
@@ -129,20 +128,20 @@ ReportBar.events = {"PLAYER_ENTERING_WORLD", "UPDATE_INVENTORY_DURABILITY", "MER

 ReportBar.OnEvent = function(self, event, ...)
 	overall = 100;
-	if not self.barframe:IsShown() then
+	if not self.barframe:IsShown() then
 		self.barframe:Show()
 		self.barframe.icon.texture:SetTexture(SV.media.dock.durabilityLabel)
-	end
-	for slot,name in pairs(inventoryMap)do
+	end
+	for slot,name in pairs(inventoryMap)do
 		local slotID = GetInventorySlotInfo(slot)
 		min,max = GetInventoryItemDurability(slotID)
-		if min then
+		if min then
 			equipment[name] = min / max * 100;
-			if min / max * 100 < overall then
-				overall = min / max * 100
-			end
-		end
-	end
+			if min / max * 100 < overall then
+				overall = min / max * 100
+			end
+		end
+	end
 	local newRed = (100 - overall) * 0.01;
 	local newGreen = overall * 0.01;
 	self.barframe.bar:SetMinMaxValues(0, 100)
@@ -159,6 +158,6 @@ ReportBar.OnEnter = function(self)
 	Reports:SetDataTip(self)
 	for name,amt in pairs(equipment)do
 		Reports.ToolTip:AddDoubleLine(name, format("%d%%", amt),1, 1, 1, SV:ColorGradient(amt * 0.01, 1, 0, 0, 1, 1, 0, 0, 1, 0))
-	end
+	end
 	Reports:ShowDataTip()
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/system/_reports/experience.lua b/SVUI_!Core/system/_reports/experience.lua
index b0b3a8a..7e037df 100644
--- a/SVUI_!Core/system/_reports/experience.lua
+++ b/SVUI_!Core/system/_reports/experience.lua
@@ -9,7 +9,7 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local string 	= _G.string;
 --[[ STRING METHODS ]]--
@@ -142,7 +142,8 @@ local function FetchExperience()
 end

 local function CacheRepData(data)
-	tinsert(data, {text = factionName, func = fn})
+	local nextIndex = #data+1;
+	data[nextIndex] = {text = factionName, func = fn};
 	tsort(data, function(a,b) return a.text < b.text end)
 end
 --[[
@@ -160,7 +161,7 @@ local Report = Reports:NewReport(REPORT_NAME, {
 Report.events = {"PLAYER_ENTERING_WORLD", "PLAYER_XP_UPDATE", "PLAYER_LEVEL_UP", "DISABLE_XP_GAIN", "ENABLE_XP_GAIN", "UPDATE_EXHAUSTION"};

 Report.OnClick = function(self, button)
-  SV.Dropdown:Open(self, self.InnerData, "Select Format")
+  SV.Dropdown:Open(self, self.InnerData, "Select Format")
 end

 Report.OnEvent = function(self, event, ...)
@@ -274,25 +275,25 @@ Report.OnInit = function(self)
   Reports.SubSettings["experience"][playerName][key] = Reports.SubSettings["experience"][playerName][key] or "XP";
   self.ExpKey = Reports.SubSettings["experience"][playerName][key]

-  local fn1 = function()
+  local fn1 = function()
     Reports.SubSettings["experience"][playerName][key] = "XP";
     self.ExpKey = "XP"
     Report.OnEvent(self)
   end

-  local fn2 = function()
+  local fn2 = function()
     Reports.SubSettings["experience"][playerName][key] = "XP_Percent";
     self.ExpKey = "XP_Percent"
     Report.OnEvent(self)
   end

-  local fn3 = function()
+  local fn3 = function()
     Reports.SubSettings["experience"][playerName][key] = "Remaining";
     self.ExpKey = "Remaining"
     Report.OnEvent(self)
   end

-  local fn4 = function()
+  local fn4 = function()
     Reports.SubSettings["experience"][playerName][key] = "Remaining_Percent";
     self.ExpKey = "Remaining_Percent"
     Report.OnEvent(self)
@@ -302,4 +303,4 @@ Report.OnInit = function(self)
   tinsert(self.InnerData, {text = "XP_Percent", func = fn2});
   tinsert(self.InnerData, {text = "Remaining", func = fn3});
   tinsert(self.InnerData, {text = "Remaining_Percent", func = fn4});
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/system/_reports/friends.lua b/SVUI_!Core/system/_reports/friends.lua
index 3a5f030..7bfd670 100644
--- a/SVUI_!Core/system/_reports/friends.lua
+++ b/SVUI_!Core/system/_reports/friends.lua
@@ -9,7 +9,7 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local pairs 	= _G.pairs;
 local ipairs 	= _G.ipairs;
@@ -19,7 +19,6 @@ local pcall 	= _G.pcall;
 local assert 	= _G.assert;
 local tostring 	= _G.tostring;
 local tonumber 	= _G.tonumber;
-local tinsert 	= _G.tinsert;
 local string 	= _G.string;
 local math 		= _G.math;
 local table 	= _G.table;
diff --git a/SVUI_!Core/system/_reports/gold.lua b/SVUI_!Core/system/_reports/gold.lua
index d29f850..6f29ec2 100644
--- a/SVUI_!Core/system/_reports/gold.lua
+++ b/SVUI_!Core/system/_reports/gold.lua
@@ -9,7 +9,7 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local pairs 	= _G.pairs;
 local ipairs 	= _G.ipairs;
@@ -19,7 +19,6 @@ local pcall 	= _G.pcall;
 local assert 	= _G.assert;
 local tostring 	= _G.tostring;
 local tonumber 	= _G.tonumber;
-local tinsert 	= _G.tinsert;
 local string 	= _G.string;
 local math 		= _G.math;
 local table 	= _G.table;
diff --git a/SVUI_!Core/system/_reports/guild.lua b/SVUI_!Core/system/_reports/guild.lua
index 03473af..6cdc054 100644
--- a/SVUI_!Core/system/_reports/guild.lua
+++ b/SVUI_!Core/system/_reports/guild.lua
@@ -9,7 +9,7 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local string 	= _G.string;
 local math 		= _G.math;
diff --git a/SVUI_!Core/system/_reports/hps.lua b/SVUI_!Core/system/_reports/hps.lua
index 8b2676e..6927fb6 100644
--- a/SVUI_!Core/system/_reports/hps.lua
+++ b/SVUI_!Core/system/_reports/hps.lua
@@ -9,7 +9,7 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local string 	= _G.string;
 --[[ STRING METHODS ]]--
diff --git a/SVUI_!Core/system/_reports/reputation.lua b/SVUI_!Core/system/_reports/reputation.lua
index 2f74eed..62c5c76 100644
--- a/SVUI_!Core/system/_reports/reputation.lua
+++ b/SVUI_!Core/system/_reports/reputation.lua
@@ -3,30 +3,29 @@
 S V U I   By: Munglunch
 ##############################################################################

-##########################################################
+##########################################################
 LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
-local tinsert 	= _G.tinsert;
 local table     = _G.table;
-local twipe     = table.wipe;
-local tsort     = table.sort;
+local twipe     = table.wipe;
+local tsort     = table.sort;
 --[[ STRING METHODS ]]--
 local format, gsub = string.format, string.gsub;
---[[
-##########################################################
+--[[
+##########################################################
 GET ADDON DATA
 ##########################################################
 ]]--
 local SV = select(2, ...)
 local L = SV.L;
 local Reports = SV.Reports;
---[[
-##########################################################
+--[[
+##########################################################
 REPUTATION STATS
 ##########################################################
 ]]--
@@ -44,37 +43,47 @@ local standingName = {
 }

 local function TruncateString(value)
-    if value >= 1e9 then
+    if value >= 1e9 then
         return ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1")
-    elseif value >= 1e6 then
+    elseif value >= 1e6 then
         return ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1")
-    elseif value >= 1e3 or value <= -1e3 then
+    elseif value >= 1e3 or value <= -1e3 then
         return ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1")
-    else
-        return value
-    end
+    else
+        return value
+    end
 end

 local sort_menu_fn = function(a,b) return a.text < b.text end;

 local function CacheRepData(data)
-	twipe(data)
-	for factionIndex = 1, GetNumFactions() do
-		local factionName, description, standingID, barMin, barMax, barValue, _, _, _, _, hasRep, isWatched, isChild = GetFactionInfo(factionIndex)
-		if(standingID) then
-			local fn = function()
-				local active = GetWatchedFactionInfo()
-				if factionName ~= active then
-					SetWatchedFactionIndex(factionIndex)
+	local count = 1;
+	local savedCount = #data;
+	local totalFactions = GetNumFactions();
+	local maxCount = totalFactions;
+	if(savedCount > totalFactions) then maxCount = savedCount; end
+	for i=1, maxCount do
+		if(i <= totalFactions) then
+			local factionName, description, standingID, barMin, barMax, barValue, _, _, _, _, hasRep, isWatched, isChild = GetFactionInfo(i)
+			if(standingID) then
+				local fn = function()
+					local active = GetWatchedFactionInfo()
+					if factionName ~= active then
+						SetWatchedFactionIndex(i)
+					end
 				end
-			end
-			tinsert(data, {text = factionName, func = fn})
+				data[count] = {text = factionName, func = fn};
+				count=count+1;
+			end
+		else
+			data[count] = nil;
+			count=count+1;
 		end
 	end
 	tsort(data, sort_menu_fn)
 end
---[[
-##########################################################
+--[[
+##########################################################
 STANDARD TYPE
 ##########################################################
 ]]--
@@ -88,18 +97,18 @@ local Report = Reports:NewReport(REPORT_NAME, {
 Report.events = {"PLAYER_ENTERING_WORLD", "UPDATE_FACTION"};

 Report.OnEvent = function(self, event, ...)
-	if self.barframe:IsShown()then
+	if self.barframe:IsShown()then
 		self.text:SetAllPoints(self)
 		self.text:SetJustifyH("CENTER")
 		self.barframe:Hide()
 		self.text:SetAlpha(1)
 		self.text:SetShadowOffset(2, -4)
-	end
+	end
 	local ID = 100
 	local friendText
 	local name, reaction, min, max, value = GetWatchedFactionInfo()
 	local numFactions = GetNumFactions();
-	if not name then
+	if not name then
 		self.text:SetText("No watched factions")
 	else
 		for i=1, numFactions do
@@ -120,7 +129,7 @@ end

 Report.OnClick = function(self, button)
 	CacheRepData(self.InnerData)
-	SV.Dropdown:Open(self, self.InnerData, "Select Faction")
+	SV.Dropdown:Open(self, self.InnerData, "Select Faction")
 end

 Report.OnEnter = function(self)
@@ -134,7 +143,7 @@ Report.OnEnter = function(self)
 		Reports.ToolTip:AddLine(' ')
 		Reports.ToolTip:AddDoubleLine(STANDING..':', friendID and friendTextLevel or _G['FACTION_STANDING_LABEL'..reaction], 1, 1, 1)
 		Reports.ToolTip:AddDoubleLine(REPUTATION..':', format('%d / %d (%d%%)', value - min, max - min, (value - min) / (max - min) * 100), 1, 1, 1)
-	end
+	end
 	Reports.ToolTip:AddLine(" ", 1, 1, 1)
 	Reports.ToolTip:AddDoubleLine("[Click]", "Change Watched Faction", 0,1,0, 0.5,1,0.5)
 	Reports:ShowDataTip(true)
@@ -146,8 +155,8 @@ Report.OnInit = function(self)
 	end
 	CacheRepData(self.InnerData)
 end
---[[
-##########################################################
+--[[
+##########################################################
 BAR TYPE
 ##########################################################
 ]]--
@@ -161,16 +170,16 @@ local ReportBar = Reports:NewReport(BAR_NAME, {
 ReportBar.events = {"PLAYER_ENTERING_WORLD", "UPDATE_FACTION"};

 ReportBar.OnEvent = function(self, event, ...)
-	if not self.barframe:IsShown()then
+	if not self.barframe:IsShown()then
 		self.barframe:Show()
 		self.barframe.icon.texture:SetTexture(SV.media.dock.reputationLabel)
 		self.text:SetAlpha(1)
 		self.text:SetShadowOffset(1, -2)
-	end
+	end
 	local bar = self.barframe.bar;
 	local name, reaction, min, max, value = GetWatchedFactionInfo()
 	local numFactions = GetNumFactions();
-	if not name then
+	if not name then
 		bar:SetStatusBarColor(0,0,0)
 		bar:SetMinMaxValues(0,1)
 		bar:SetValue(0)
@@ -193,12 +202,12 @@ ReportBar.OnEvent = function(self, event, ...)
 		bar:SetMinMaxValues(min, max)
 		bar:SetValue(value)
 		self.text:SetText(txt)
-	end
+	end
 end

 ReportBar.OnClick = function(self, button)
 	CacheRepData(self.InnerData)
-	SV.Dropdown:Open(self, self.InnerData, "Select Faction")
+	SV.Dropdown:Open(self, self.InnerData, "Select Faction")
 end

 ReportBar.OnEnter = function(self)
@@ -212,7 +221,7 @@ ReportBar.OnEnter = function(self)
 		Reports.ToolTip:AddLine(' ')
 		Reports.ToolTip:AddDoubleLine(STANDING..':', friendID and friendTextLevel or _G['FACTION_STANDING_LABEL'..reaction], 1, 1, 1)
 		Reports.ToolTip:AddDoubleLine(REPUTATION..':', format('%d / %d (%d%%)', value - min, max - min, (value - min) / (max - min) * 100), 1, 1, 1)
-	end
+	end
 	Reports.ToolTip:AddLine(" ", 1, 1, 1)
 	Reports.ToolTip:AddDoubleLine("[Click]", "Change Watched Faction", 0,1,0, 0.5,1,0.5)
 	Reports:ShowDataTip(true)
@@ -223,4 +232,4 @@ ReportBar.OnInit = function(self)
 		self.InnerData = {}
 	end
 	CacheRepData(self.InnerData)
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/system/_reports/system.lua b/SVUI_!Core/system/_reports/system.lua
index a61d4eb..e3a4ffe 100644
--- a/SVUI_!Core/system/_reports/system.lua
+++ b/SVUI_!Core/system/_reports/system.lua
@@ -9,7 +9,7 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local collectgarbage    = _G.collectgarbage;
 local string 	= _G.string;
diff --git a/SVUI_!Core/system/_reports/template.lua b/SVUI_!Core/system/_reports/template.lua
index 98c7563..90154aa 100644
--- a/SVUI_!Core/system/_reports/template.lua
+++ b/SVUI_!Core/system/_reports/template.lua
@@ -3,13 +3,13 @@
 S V U I   By: Munglunch
 ##############################################################################

-##########################################################
+##########################################################
 LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local pairs 	= _G.pairs;
 local ipairs 	= _G.ipairs;
@@ -19,7 +19,6 @@ local pcall 	= _G.pcall;
 local assert 	= _G.assert;
 local tostring 	= _G.tostring;
 local tonumber 	= _G.tonumber;
-local tinsert 	= _G.tinsert;
 local string 	= _G.string;
 local math 		= _G.math;
 local table 	= _G.table;
@@ -32,16 +31,16 @@ local gmatch, gsub = string.gmatch, string.gsub;
 local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round;  -- Basic
 --[[ TABLE METHODS ]]--
 local twipe, tsort = table.wipe, table.sort;
---[[
-##########################################################
+--[[
+##########################################################
 GET ADDON DATA
 ##########################################################
 ]]--
 local SV = select(2, ...)
 local L = SV.L
 local Reports = SV.Reports;
---[[
-##########################################################
+--[[
+##########################################################
 REPORT TEMPLATE
 ##########################################################
 ]]--
@@ -89,4 +88,4 @@ end

 Report.OnUpdate = function(self, button)
 	-- DO STUFF
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/system/_reports/time.lua b/SVUI_!Core/system/_reports/time.lua
index c61c831..74e738a 100644
--- a/SVUI_!Core/system/_reports/time.lua
+++ b/SVUI_!Core/system/_reports/time.lua
@@ -9,7 +9,7 @@ LOCALIZED LUA FUNCTIONS
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
 local type 		= _G.type;
 local string 	= _G.string;
diff --git a/SVUI_!Core/system/_reports/tokens.lua b/SVUI_!Core/system/_reports/tokens.lua
index 4513ffe..6dac58d 100644
--- a/SVUI_!Core/system/_reports/tokens.lua
+++ b/SVUI_!Core/system/_reports/tokens.lua
@@ -3,33 +3,32 @@
 S V U I   By: Munglunch
 ##############################################################################

-##########################################################
+##########################################################
 LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
 --[[ GLOBALS ]]--
 local _G = _G;
-local unpack 	= _G.unpack;
+
 local select 	= _G.select;
-local tinsert 	= _G.tinsert;
 local table     = _G.table;
 local twipe     = table.wipe;
-local tsort     = table.sort;
+local tsort     = table.sort;
 local GetCurrencyInfo           = _G.GetCurrencyInfo;
 local GetNumWatchedTokens       = _G.GetNumWatchedTokens;
 local GetBackpackCurrencyInfo   = _G.GetBackpackCurrencyInfo;
 local GetProfessions            = _G.GetProfessions;
 local IsLoggedIn                = _G.IsLoggedIn;
---[[
-##########################################################
+--[[
+##########################################################
 GET ADDON DATA
 ##########################################################
 ]]--
 local SV = select(2, ...)
 local L = SV.L;
 local Reports = SV.Reports;
---[[
-##########################################################
+--[[
+##########################################################
 GOLD STATS
 ##########################################################
 ]]--
@@ -51,12 +50,13 @@ end

 local function AddToTokenMenu(self, id, key)
   local itemName, _, tex, _, _, _, _ = GetCurrencyInfo(id)
-  local fn = function()
+  local fn = function()
     Reports.Accountant["tokens"][playerName][key] = id;
     self.TokenKey = id
     Tokens_OnEvent(self)
-  end
-  tinsert(self.InnerData, {text = itemName, icon = "\124T"..tex..":12\124t ", func = fn});
+  end
+  local nextIndex = #self.InnerData+1;
+  self.InnerData[nextIndex] = {text = itemName, icon = "\124T"..tex..":12\124t ", func = fn};
 end

 local function CacheTokenData(self)
@@ -148,8 +148,8 @@ local function TokenInquiry(id, weekly, capped)
     end
   end
 end
---[[
-##########################################################
+--[[
+##########################################################
 REPORT TEMPLATE
 ##########################################################
 ]]--
@@ -165,7 +165,7 @@ Report.OnEvent = Tokens_OnEvent;

 Report.OnClick = function(self, button)
   CacheTokenData(self);
-  SV.Dropdown:Open(self, self.InnerData, "Select Currency", 200)
+  SV.Dropdown:Open(self, self.InnerData, "Select Currency", 200)
 end

 Report.OnEnter = function(self)
@@ -252,4 +252,4 @@ Report.OnInit = function(self)
   Reports.Accountant["tokens"][playerName][key] = Reports.Accountant["tokens"][playerName][key] or 738;
   self.TokenKey = Reports.Accountant["tokens"][playerName][key]
   CacheTokenData(self);
-end
\ No newline at end of file
+end
diff --git a/SVUI_!Core/system/api.lua b/SVUI_!Core/system/api.lua
index dc76c67..781945e 100644
--- a/SVUI_!Core/system/api.lua
+++ b/SVUI_!Core/system/api.lua
@@ -23,7 +23,6 @@ local table     = _G.table;
 local string    = _G.string;
 local math      = _G.math;
 local wipe      = _G.wipe;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 --[[ MATH METHODS ]]--
 local floor, abs, min, max = math.floor, math.abs, math.min, math.max;
@@ -166,35 +165,35 @@ APPENDED POSITIONING METHODS
 ]]--
 local FIND_EDGES = {
     CENTER = function(frame, x, y)
-        local xX,yY = frame:GetCenter();
+        local xX,yY = frame:GetCenter();
         return (xX + x),(yY + y);
     end,
-    TOP = function(frame, x, y)
-        local yY = frame:GetTop() - UIParent:GetHeight() + y;
+    TOP = function(frame, x, y)
+        local yY = frame:GetTop() - UIParent:GetHeight() + y;
         return x,yY;
     end,
-    TOPLEFT = function(frame, x, y)
+    TOPLEFT = function(frame, x, y)
         local xX = frame:GetLeft() + x;
-        local yY = frame:GetTop() - UIParent:GetHeight() + y;
+        local yY = frame:GetTop() - UIParent:GetHeight() + y;
         return xX,yY;
     end,
-    TOPRIGHT = function(frame, x, y)
+    TOPRIGHT = function(frame, x, y)
         local xX = frame:GetRight() - UIParent:GetWidth() + x;
         local yY = frame:GetTop() - UIParent:GetHeight() + y;
         return xX,yY;
     end,
-    BOTTOM = function(frame, x, y)
-        local yY = frame:GetBottom() + y;
+    BOTTOM = function(frame, x, y)
+        local yY = frame:GetBottom() + y;
         return x,yY;
     end,
-    BOTTOMLEFT = function(frame, x, y)
+    BOTTOMLEFT = function(frame, x, y)
         local xX = frame:GetLeft() + x;
         local yY = frame:GetBottom() + y;
         return xX,yY;
     end,
-    BOTTOMRIGHT = function(frame, x, y)
+    BOTTOMRIGHT = function(frame, x, y)
         local xX = frame:GetRight() - UIParent:GetWidth() + x;
-        local yY = frame:GetBottom() + y;
+        local yY = frame:GetBottom() + y;
         return xX,yY;
     end,
 };
@@ -885,7 +884,7 @@ function MOD:APPLY(frame, templateName, underlay, padding, xOffset, yOffset, def
             else
                 frame.UpdateBackdrop = HookCustomBackdrop_TypeB
             end
-
+
             frame.BackdropNeedsUpdate = true
         end
     end
@@ -1020,7 +1019,8 @@ MOD.Methods["Button"] = function(self, frame, inverse, xOffset, yOffset, default
     CommonButtonSettings(frame, true)
     if(defaultColor) then
         frame.Panel:SetAttribute("panelID", "button"..defaultColor)
-        tinsert(LIVE_UPDATE_FRAMES, frame);
+        local count = #LIVE_UPDATE_FRAMES+1;
+        LIVE_UPDATE_FRAMES[count] = frame;
     end
 end;

@@ -1183,7 +1183,8 @@ MOD.Methods["DockButton"] = function(self, frame, inverse, template)
     end

     if(not frame.Panel:GetAttribute("panelSkipUpdate")) then
-        tinsert(LIVE_UPDATE_FRAMES, frame);
+      local count = #LIVE_UPDATE_FRAMES+1;
+      LIVE_UPDATE_FRAMES[count] = frame;
     end
 end;

@@ -1200,7 +1201,8 @@ MOD.Methods["Frame"] = function(self, frame, inverse, styleName, noupdate, overr
     end
     self:APPLY(frame, styleName, underlay, padding, xOffset, yOffset, defaultColor)
     if(not noupdate) then
-        tinsert(LIVE_UPDATE_FRAMES, frame);
+      local count = #LIVE_UPDATE_FRAMES+1;
+      LIVE_UPDATE_FRAMES[count] = frame;
     end
 end;
 --[[
@@ -1345,7 +1347,7 @@ SCREEN HANDLER (IN DEVELOPMENT)
 function SV:UI_SCALE_CHANGED(event)
     local managedScale = self.db.screen.autoScale;
     local gxWidth, gxHeight, gxScale, customScale = ScreenUpdate();
-
+
     if(managedScale) then
         local needCalc = true;
         if(self.db.screen.advanced) then
diff --git a/SVUI_!Core/system/automations.lua b/SVUI_!Core/system/automations.lua
index aed224f..da6ee98 100644
--- a/SVUI_!Core/system/automations.lua
+++ b/SVUI_!Core/system/automations.lua
@@ -37,7 +37,6 @@ local random        = math.random;
 local table         = _G.table;
 local tsort         = table.sort;
 local tconcat       = table.concat;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local twipe         = _G.wipe;
 --BLIZZARD API
diff --git a/SVUI_!Core/system/core.lua b/SVUI_!Core/system/core.lua
index 77c5176..8e75e08 100644
--- a/SVUI_!Core/system/core.lua
+++ b/SVUI_!Core/system/core.lua
@@ -39,7 +39,6 @@ local random        = math.random;
 local table         = _G.table;
 local tsort         = table.sort;
 local tconcat       = table.concat;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local wipe          = _G.wipe;
 --BLIZZARD API
@@ -160,9 +159,10 @@ if(not CUSTOM_CLASS_COLORS) then
     --     ["DEATHKNIGHT"]   = { r = 0.77,  g = 0.12,  b = 0.23 },
     --     ["MONK"]          = { r = 0.33,  g = 0.54,  b = 0.52 },
     -- };
-
+    local classCount = 1;
     for class in pairs(RAID_CLASS_COLORS) do
-        tinsert(classes, class)
+      classes[classCount] = class;
+      classCount=classCount+1;
     end
     tsort(classes)
     setmetatable(CUSTOM_CLASS_COLORS,{
diff --git a/SVUI_!Core/system/dock.lua b/SVUI_!Core/system/dock.lua
index d7cc385..7d7b122 100644
--- a/SVUI_!Core/system/dock.lua
+++ b/SVUI_!Core/system/dock.lua
@@ -60,7 +60,7 @@ SV.SpecialFX:Register("dragging_highlight_bottom", [[Spells\Creature_spellportal

 local ToggleDraggingMode;
 local DOCK_CHECK, DRAG_LASTINDEX, DRAG_ORDERINDEX, DRAG_TARGETBAR, DRAG_BUTTONWIDTH, DRAG_ENABLED;
-local ORDER_TEMP, ORDER_TEST, DOCK_REGISTRY, DOCK_DROPDOWN_OPTIONS = {}, {}, {}, {};
+local ORDER_TEMP, DOCK_REGISTRY, DOCK_DROPDOWN_OPTIONS = {}, {}, {};
 local DOCK_LOCATIONS = {
 	["BottomLeft"] = {1, "LEFT", true, "ANCHOR_TOPLEFT"},
 	["BottomRight"] = {-1, "RIGHT", true, "ANCHOR_TOPLEFT"},
@@ -878,22 +878,27 @@ local DockBar_NextDefault = function(self)
 end

 local DockBar_UpdateOrder = function(self)
-	--print('DockBar_UpdateOrder')
-	wipe(ORDER_TEST);
-	for k,v in pairs(self.Data.Order) do
-		self.Data.Order[k] = nil;
-	end
+	local ORDER_TEMP = {};
 	local location = self.Data.Location;
 	local buttonList = self.Data.Buttons;
+	local orderList = self.Data.Order;
+	local internalCount = #orderList;
+
+	for i=1, internalCount do
+		orderList[i] = nil;
+	end
+
+	local saved = MOD.private.Order[location];
+	local savedCount = #saved;
 	local safeIndex = 1;
-	for i = 1, #MOD.private.Order[location] do
-		local nextName = MOD.private.Order[location][i];
+	for i=1, savedCount do
+		local nextName = saved[i];
 		local nextButton = buttonList[nextName];
 		if(nextButton) then
-			if(not ORDER_TEST[nextName]) then
-				ORDER_TEST[nextName] = true;
+			if(not ORDER_TEMP[nextName]) then
+				ORDER_TEMP[nextName] = true;
 				nextButton.OrderIndex = safeIndex;
-				self.Data.Order[safeIndex] = nextName;
+				orderList[safeIndex] = nextName;
 				safeIndex = safeIndex + 1;
 			end
 		end
@@ -901,61 +906,65 @@ local DockBar_UpdateOrder = function(self)
 end

 local DockBar_ChangeOrder = function(self, button, targetIndex)
-	--print('DockBar_ChangeOrder')
-
+	local ORDER_TEMP = {};
 	local location = self.Data.Location;
 	local targetName = button:GetName();
 	local currentIndex = button.OrderIndex;
-	wipe(ORDER_TEST);
-	wipe(ORDER_TEMP);
-
-	for i = 1, #MOD.private.Order[location] do
-		local nextName = MOD.private.Order[location][i];
+	local saved = MOD.private.Order[location];
+	local maxCount = #saved;
+	local count = 1;
+	for i=1, maxCount do
+		local nextName = saved[i];
 		if(i == targetIndex) then
 			if(currentIndex > targetIndex) then
-				tinsert(ORDER_TEMP, targetName)
-				tinsert(ORDER_TEMP, nextName)
+				ORDER_TEMP[count] = targetName;
+				count=count+1;
+				ORDER_TEMP[count] = nextName;
+				count=count+1;
 			else
-				tinsert(ORDER_TEMP, nextName)
-				tinsert(ORDER_TEMP, targetName)
+				ORDER_TEMP[count] = nextName;
+				count=count+1;
+				ORDER_TEMP[count] = targetName;
+				count=count+1;
 			end
 		elseif(targetName ~= nextName) then
-			tinsert(ORDER_TEMP, nextName)
+			ORDER_TEMP[count] = nextName;
+			count=count+1;
 		end
 	end

-	wipe(MOD.private.Order[location]);
-	local safeIndex = 1;
-	for i = 1, #ORDER_TEMP do
-		local nextName = ORDER_TEMP[i];
-		tinsert(MOD.private.Order[location], nextName);
+	for i=1, maxCount do
+		MOD.private.Order[location][i] = ORDER_TEMP[i];
 	end

 	DockBar_UpdateOrder(self);
 end

 local DockBar_CheckOrder = function(self, targetName)
-	for otherLoc,otherData in pairs(MOD.private.Order) do
+	local masterOrder = MOD.private.Order;
+	local masterLocation = MOD.private.Locations;
+	for otherLoc,otherData in pairs(masterOrder) do
 		for x = 1, #otherData do
 			local otherName = otherData[x];
-			local registeredLocation = MOD.private.Locations[otherName];
+			local registeredLocation = masterLocation[otherName];
 			if(registeredLocation ~= otherLoc) then
-				MOD.private.Order[otherLoc][x] = nil;
+				masterOrder[otherLoc][x] = nil;
 			end
 		end
 	end

 	local found = false;
 	local location = self.Data.Location;
-	local savedOrderList = MOD.private.Order[location];
-	if(not savedOrderList) then return end
-	for i = 1, #savedOrderList do
-		if(savedOrderList[i] == targetName) then
+	local saved = masterOrder[location];
+	if(not saved) then return end
+	local maxCount = #saved;
+	for i = 1, maxCount do
+		if(saved[i] == targetName) then
 			found = true;
 		end
 	end
 	if(not found) then
-		tinsert(MOD.private.Order[location], targetName);
+		saved[maxCount+1] = targetName;
 	end

 	DockBar_UpdateOrder(self);
@@ -1040,9 +1049,9 @@ local DockBar_AddButton = function(self, button, order)
 	order = order or 0;
 	--if(self.Data.Buttons[name] and (order == 0)) then return end
 	local registeredLocation = MOD.private.Locations[name];
-
+
 	if(registeredLocation) then
-		if(registeredLocation == 'Floating') then
+		if(registeredLocation == 'Floating') then
 			return
 		elseif(registeredLocation ~= currentLocation) then
 			if(MOD[registeredLocation].Bar.Data.Buttons[name]) then
@@ -1059,7 +1068,7 @@ local DockBar_AddButton = function(self, button, order)

 	button:Show()
 	self.Data.Buttons[name] = button;
-
+
 	DockBar_CheckOrder(self, name);
 	if(order > 0) then
 		DockBar_ChangeOrder(self, button, order)
@@ -1218,7 +1227,7 @@ local DockButton_OnDragStop = function(self)
 			end

 			target:Add(self, DRAG_ORDERINDEX);
-
+
 			if(self.FrameLink and self.FrameLink.UpdateBackdrop) then
 				self.FrameLink:UpdateBackdrop()
 			end
@@ -1445,7 +1454,7 @@ local DockBar_CreateButton = function(self, displayName, globalName, texture, ti
 	end

 	button.Parent 				= self;
-  	button.OrderIndex 			= 0;
+	button.OrderIndex 			= 0;
 	button.LocationKey  		= globalName;
 	button.SetDocked 			= DockButton_SetDocked;
 	button.SetClickCallbacks 	= DockButton_SetClickCallbacks;
@@ -1464,7 +1473,7 @@ local DockBar_CreateButton = function(self, displayName, globalName, texture, ti
 		button.ShowDockOptions 	= DockButton_ShowDockOptions;
 	end

-  self:Add(button)
+	self:Add(button)

 	return button
 end
@@ -2032,11 +2041,11 @@ function MOD:Load()
 		dock.Bar.ToolBar:ClearAllPoints()

 		if(dock.Bar.Button) then
-	    	dock.Bar.Button:SetSize(buttonsize, buttonsize)
-	    	self:SetButtonTheme(dock.Bar.Button, buttonsize)
-	    	dock.Bar.Button.Icon:SetTexture(SV.media.dock.sizeIcon)
-	    	dock.Bar.ToolBar:SetSize(1, buttonsize)
-	    	dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar.Button, barReverse, (spacing * mod), 0)
+			dock.Bar.Button:SetSize(buttonsize, buttonsize)
+			self:SetButtonTheme(dock.Bar.Button, buttonsize)
+			dock.Bar.Button.Icon:SetTexture(SV.media.dock.sizeIcon)
+			dock.Bar.ToolBar:SetSize(1, buttonsize)
+			dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar.Button, barReverse, (spacing * mod), 0)
 			dock.Bar.Button:SetPanelColor("default")
 			dock.Bar.Button.Icon:SetGradient(unpack(SV.media.gradient.icon))
 			if(location:find('Left')) then
@@ -2057,11 +2066,11 @@ function MOD:Load()
 			dock.Bar.Button:SetScript("OnClick", CornerButton_OnClick)

 			if(dock.Bar.Button2) then
-		    	dock.Bar.Button2:SetSize(buttonsize, buttonsize)
-		    	self:SetButtonTheme(dock.Bar.Button2, buttonsize)
-		    	dock.Bar.Button2.Icon:SetTexture(SV.media.dock.optionsIcon)
-		    	dock.Bar.ToolBar:SetSize(1, buttonsize)
-		    	dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar.Button2, barReverse, (spacing * mod), 0)
+				dock.Bar.Button2:SetSize(buttonsize, buttonsize)
+				self:SetButtonTheme(dock.Bar.Button2, buttonsize)
+				dock.Bar.Button2.Icon:SetTexture(SV.media.dock.optionsIcon)
+				dock.Bar.ToolBar:SetSize(1, buttonsize)
+				dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar.Button2, barReverse, (spacing * mod), 0)
 				dock.Bar.Button2:SetPanelColor("default")
 				dock.Bar.Button2.Icon:SetGradient(unpack(SV.media.gradient.icon))
 				if(location:find('Left')) then
@@ -2077,26 +2086,26 @@ function MOD:Load()

 				dock.Bar.Button2.ToggleFunc = CornerButton2_OnClick;
 				dock.Bar.Button2:SetScript("OnClick", CornerButton_OnClick)
-		    end
-	    else
-	    	dock.Bar.ToolBar:SetSize(1, buttonsize)
-	    	dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar, barAnchor, 0, 0)
-	    end
+			end
+		else
+			dock.Bar.ToolBar:SetSize(1, buttonsize)
+			dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar, barAnchor, 0, 0)
+		end

-	    dock:SetParent(SV.Screen)
-	    dock:ClearAllPoints()
-	    dock:SetPoint(anchor, dock.Bar, reverse, 0, (12 * vertMod))
-	    dock:SetSize(width, height)
-	    dock:SetAttribute("buttonSize", buttonsize)
-	    dock:SetAttribute("spacingSize", spacing)
+		dock:SetParent(SV.Screen)
+		dock:ClearAllPoints()
+		dock:SetPoint(anchor, dock.Bar, reverse, 0, (12 * vertMod))
+		dock:SetSize(width, height)
+		dock:SetAttribute("buttonSize", buttonsize)
+		dock:SetAttribute("spacingSize", spacing)

-	    dock.Alert:ClearAllPoints()
-	    dock.Alert:SetSize(width, 1)
-	    dock.Alert:SetPoint(anchor, dock, anchor, 0, 0)
+		dock.Alert:ClearAllPoints()
+		dock.Alert:SetSize(width, 1)
+		dock.Alert:SetPoint(anchor, dock, anchor, 0, 0)

-	    dock.Window:ClearAllPoints()
-	    dock.Window:SetSize(width, height)
-	    dock.Window:SetPoint(anchor, dock.Alert, reverse, 0, 4)
+		dock.Window:ClearAllPoints()
+		dock.Window:SetSize(width, height)
+		dock.Window:SetPoint(anchor, dock.Alert, reverse, 0, 4)

 		SV:NewAnchor(dock.Bar, location .. " Dock ToolBar");
 		SV:SetAnchorResizing(dock.Bar, dockBarPostSizeFunc, 10, 500, 10, 80);
diff --git a/SVUI_!Core/system/dropdown.lua b/SVUI_!Core/system/dropdown.lua
index bc54855..634612b 100644
--- a/SVUI_!Core/system/dropdown.lua
+++ b/SVUI_!Core/system/dropdown.lua
@@ -28,7 +28,6 @@ local match         = string.match;
 local gsub          = string.gsub;
 --TABLE
 local table 		= _G.table;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local twipe 		= _G.wipe;
 --MATH
@@ -278,7 +277,8 @@ local function InitializeDropdown()
 	SV.Dropdown:SetClampedToScreen(true);
 	SV.Dropdown:SetSize(155, 94)

-	tinsert(UISpecialFrames, SV.Dropdown:GetName());
+	local uisfCount = #UISpecialFrames + 1;
+	UISpecialFrames[uisfCount] = SV.Dropdown:GetName();
 	SV.Dropdown:Hide();

 	-- WorldFrame:HookScript("OnMouseDown", function()
diff --git a/SVUI_!Core/system/gear.lua b/SVUI_!Core/system/gear.lua
index 0592dcc..ca9974e 100644
--- a/SVUI_!Core/system/gear.lua
+++ b/SVUI_!Core/system/gear.lua
@@ -424,8 +424,9 @@ function SV:BuildEquipmentMap()
 					player, bank, bags, _, slotIndex, bagIndex = EquipmentManager_UnpackLocation(location);
 					if((bank or bags) and (slotIndex and bagIndex)) then
 						loc = format("%d_%d", bagIndex, slotIndex);
-						GEARSET_LISTING[loc] = (GEARSET_LISTING[loc] or {});
-						tinsert(GEARSET_LISTING[loc], set);
+						GEARSET_LISTING[loc] = GEARSET_LISTING[loc] or {};
+            local gslCount = #GEARSET_LISTING[loc] + 1
+						GEARSET_LISTING[loc][gslCount] = set;
 					end
 				end
 			end
diff --git a/SVUI_!Core/system/henchmen.lua b/SVUI_!Core/system/henchmen.lua
index 7f0ee9a..adf018f 100644
--- a/SVUI_!Core/system/henchmen.lua
+++ b/SVUI_!Core/system/henchmen.lua
@@ -37,7 +37,6 @@ local random        = math.random;
 local table         = _G.table;
 local tsort         = table.sort;
 local tconcat       = table.concat;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local twipe         = _G.wipe;
 --BLIZZARD API
@@ -304,8 +303,8 @@ local function CreateHenchmenSubOptions(buttonIndex,optionIndex)
 	frame.txthigh:SetFontObject(SVUI_Font_Default)
 	frame.txthigh:SetTextColor(1,1,0)
 	SV.Animate:Slide(frame,500,0)
-
-	tinsert(SUBOPTIONS,frame)
+	local soCount = #SUBOPTIONS + 1;
+	SUBOPTIONS[soCount] = frame;
 end

 local function CreateHenchmenFrame()
diff --git a/SVUI_!Core/system/letsride.lua b/SVUI_!Core/system/letsride.lua
index dfeb671..e16119f 100644
--- a/SVUI_!Core/system/letsride.lua
+++ b/SVUI_!Core/system/letsride.lua
@@ -12,7 +12,6 @@ local select 		= _G.select;
 local pairs 		= _G.pairs;
 local type          = _G.type;
 local tonumber		= _G.tonumber;
-local tinsert 		= _G.tinsert;
 local table 		= _G.table;
 local math 			= _G.math;
 local bit 			= _G.bit;
diff --git a/SVUI_!Core/system/mail.lua b/SVUI_!Core/system/mail.lua
index c55e37d..69d44bd 100644
--- a/SVUI_!Core/system/mail.lua
+++ b/SVUI_!Core/system/mail.lua
@@ -37,7 +37,6 @@ local random        = math.random;
 local table         = _G.table;
 local tsort         = table.sort;
 local tconcat       = table.concat;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local twipe         = _G.wipe;
 --BLIZZARD API
diff --git a/SVUI_!Core/system/overrides.lua b/SVUI_!Core/system/overrides.lua
index 6e1c4a0..d36dc28 100644
--- a/SVUI_!Core/system/overrides.lua
+++ b/SVUI_!Core/system/overrides.lua
@@ -21,7 +21,6 @@ local rawset        = _G.rawset;
 local rawget        = _G.rawget;
 local tostring      = _G.tostring;
 local tonumber      = _G.tonumber;
-local tinsert 	= _G.tinsert;
 local string 	= _G.string;
 local math 		= _G.math;
 --[[ STRING METHODS ]]--
@@ -533,14 +532,19 @@ local function CreateRollFrame()
 end

 local function FetchRollFrame()
-	for _,roll in ipairs(SV.RollFrames)do
-		if not roll.rollID then
-			return roll
+	local rollFrames = SV.RollFrames;
+	local rollCount = #rollFrames;
+	for i=1, rollCount do
+		local frame = rollFrames[i];
+		if not frame.rollID then
+			return frame
 		end
 	end
-	local roll = CreateRollFrame()
-	roll:SetPoint("TOP", next(SV.RollFrames) and SV.RollFrames[#SV.RollFrames] or SVUI_AlertFrame, "BOTTOM", 0, -4);
-	tinsert(SV.RollFrames, roll)
+
+	local anchorParent = rollFrames[rollCount] or SVUI_AlertFrame;
+	local roll = CreateRollFrame();
+	roll:SetPoint("TOP", anchorParent, "BOTTOM", 0, -4);
+	rollFrames[rollCount+1] = roll;
 	return roll
 end
 --[[
diff --git a/SVUI_!Core/system/profile.lua b/SVUI_!Core/system/profile.lua
index 8fe8948..de3b04b 100644
--- a/SVUI_!Core/system/profile.lua
+++ b/SVUI_!Core/system/profile.lua
@@ -21,7 +21,6 @@ local tonumber          = _G.tonumber;
 local getmetatable      = _G.getmetatable;
 local setmetatable      = _G.setmetatable;
 local collectgarbage    = _G.collectgarbage;
-local tinsert   = _G.tinsert;
 local string    = _G.string;
 local math      = _G.math;
 local table     = _G.table;
diff --git a/SVUI_!Core/system/reports.lua b/SVUI_!Core/system/reports.lua
index b776cd0..9dcc07d 100644
--- a/SVUI_!Core/system/reports.lua
+++ b/SVUI_!Core/system/reports.lua
@@ -412,13 +412,16 @@ function MOD:EnableReport(socket, name)
 end

 function MOD:NewReport(name, obj, LDBname)
-	if self.Plugins[name] then return end
-	self.Plugins[name] = obj or {}
+	local pluginList = self.Plugins;
+	local statMenu = StatMenuListing;
+	if pluginList[name] then return end
+	pluginList[name] = obj or {}
 	if(LDBname) then
-		self.Plugins[name].LDBName = LDBname
-		self.Plugins[name].ReportName = name
+		pluginList[name].LDBName = LDBname
+		pluginList[name].ReportName = name
 	end
-	tinsert(StatMenuListing, name)
+	local statCount = #statMenu + 1;
+	StatMenuListing[statCount] = name;
 	return obj
 end

diff --git a/SVUI_!Core/system/utilities.lua b/SVUI_!Core/system/utilities.lua
index 23c28c9..e3454f8 100644
--- a/SVUI_!Core/system/utilities.lua
+++ b/SVUI_!Core/system/utilities.lua
@@ -24,7 +24,6 @@ local tonumber      = _G.tonumber;
 local table         = _G.table;
 local string        = _G.string;
 local math          = _G.math;
-local tinsert       = _G.tinsert;
 local tremove       = _G.tremove;
 local twipe         = _G.wipe;
 --[[ STRING METHODS ]]--
@@ -63,7 +62,8 @@ do
         if(frame.GetParent) then
             parent = frame:GetParent();
         end
-        tinsert(FRAMELIST, {frame = frame, parent = parent})
+        local frameCount = #FRAMELIST + 1;
+        FRAMELIST[frameCount] = {frame = frame, parent = parent};
     end

     function SV:AuditVisibility(hidden)
diff --git a/SVUI_!Options/SVUI_!Options.lua b/SVUI_!Options/SVUI_!Options.lua
index 66a1c53..e6a8957 100644
--- a/SVUI_!Options/SVUI_!Options.lua
+++ b/SVUI_!Options/SVUI_!Options.lua
@@ -23,7 +23,6 @@ local tostring      = _G.tostring;
 local tonumber      = _G.tonumber;
 local getmetatable  = _G.getmetatable;
 local setmetatable  = _G.setmetatable;
-local tinsert 	 =  _G.tinsert;
 local table 	 =  _G.table;
 local wipe       =  _G.wipe;
 --[[ TABLE METHODS ]]--
diff --git a/SVUI_!Options/UnitFrames.lua b/SVUI_!Options/UnitFrames.lua
index 4f6450a..9503f0c 100644
--- a/SVUI_!Options/UnitFrames.lua
+++ b/SVUI_!Options/UnitFrames.lua
@@ -23,7 +23,6 @@ local tostring      = _G.tostring;
 local tonumber      = _G.tonumber;
 local getmetatable  = _G.getmetatable;
 local setmetatable  = _G.setmetatable;
-local tinsert 	 	= _G.tinsert;
 local table 	 	= _G.table;
 local string 	 	= _G.string;
 local upper 		= string.upper;
@@ -87,7 +86,7 @@ local FRAME_MAP = {
 	["focustarget"] = "SVUI_FocusTarget",
 };

-local tempFilterTable, watchedBuffs, filterList = {}, {}, {};
+local tempFilterTable, filterList = {}, {};

 if(not SV.db.Filters.PetBuffWatch) then
 	SV.db.Filters.PetBuffWatch = {}
@@ -97,13 +96,6 @@ if(not SV.db.Filters.BuffWatch) then
 	SV.db.Filters.BuffWatch = {}
 end

-local function CacheWatchedBuffs(data)
-	wipe(watchedBuffs)
-	for spellID, watchData in pairs(data) do
-		tinsert(watchedBuffs, watchData)
-	end
-end
-
 local function SetWatchedBuff(stringID, id, data, enable, point, color, anyUnit)
 	if(not data[id]) then
 		data[stringID] = {["enable"] = enable, ["id"] = id, ["point"] = point, ["color"] = color, ["anyUnit"] = anyUnit}
@@ -2025,8 +2017,6 @@ end;
 SVUIOptions.FilterOptionGroups['BuffWatch'] = function(selectedSpell)
 	local FILTER = SV.db.Filters.BuffWatch;

-	--CacheWatchedBuffs(SV.db.Filters.BuffWatch)
-
 	local RESULT = {
 		type = "group",
 		name = 'BuffWatch',
@@ -2088,7 +2078,6 @@ SVUIOptions.FilterOptionGroups['BuffWatch'] = function(selectedSpell)
 				type = "select",
 				order = 3,
 				values = function()
-					--CacheWatchedBuffs(SV.db.Filters.BuffWatch)
 					wipe(tempFilterTable)
 					for id, watchData in pairs(FILTER) do
 						local spellID = tonumber(id)
@@ -2225,7 +2214,6 @@ SVUIOptions.FilterOptionSpells['BuffWatch'] = function(selectedSpell)
 end;

 SVUIOptions.FilterOptionGroups['PetBuffWatch'] = function(selectedSpell)
-	--CacheWatchedBuffs(SV.db.Filters.PetBuffWatch)
 	local FILTER = SV.db.Filters.PetBuffWatch;
 	local RESULT = {
 		type = "group",
@@ -2287,7 +2275,6 @@ SVUIOptions.FilterOptionGroups['PetBuffWatch'] = function(selectedSpell)
 				type = "select",
 				order = 3,
 				values = function()
-					--CacheWatchedBuffs(FILTER)
 					wipe(tempFilterTable)
 					for id, watchData in pairs(FILTER) do
 						local spellID = tonumber(id)
diff --git a/SVUI_ActionBars/SVUI_ActionBars.lua b/SVUI_ActionBars/SVUI_ActionBars.lua
index e7ab283..00c9b84 100644
--- a/SVUI_ActionBars/SVUI_ActionBars.lua
+++ b/SVUI_ActionBars/SVUI_ActionBars.lua
@@ -1514,20 +1514,20 @@ end
 IconIntroTracker_OnEvent = function(self, event, ...)
   if event == "SPELL_PUSHED_TO_ACTIONBAR" or event == "COMBAT_LOG_EVENT_UNFILTERED" then
 		if InCombatLockdown() then
-			if not self.queue then
-				self.queue={}
-			end
+			self.queue=self.queue or {};
+			local queueCount = #self.queue + 1;
 			local spellID, slotIndex, slotPos = ...;
-			tinsert(self.queue,{spellID,slotIndex,slotPos})
+			self.queue[queueCount]={spellID,slotIndex,slotPos};
 			self:RegisterEvent("PLAYER_REGEN_ENABLED")
 		else
 			pushSpellToActionBar(self,...)
 		end
 	elseif event == "PLAYER_REGEN_ENABLED" then
-		for i=1,#self.queue do
-			pushSpellToActionBar(self,unpack(self.queue[i]))
+		local queueCount = #self.queue;
+		for i=1, queueCount do
+			pushSpellToActionBar(self, unpack(self.queue[i]))
+			self.queue[i]=nil;
 		end
-		wipe(self.queue)
 		self:UnregisterEvent("PLAYER_REGEN_ENABLED")
     end
 end
diff --git a/SVUI_ActionBars/components/totem.lua b/SVUI_ActionBars/components/totem.lua
index 205dcba..0204ecb 100644
--- a/SVUI_ActionBars/components/totem.lua
+++ b/SVUI_ActionBars/components/totem.lua
@@ -12,7 +12,6 @@ local select 	= _G.select;
 local pairs 	= _G.pairs;
 local ipairs 	= _G.ipairs;
 local type 		= _G.type;
-local tinsert 	= _G.tinsert;
 local math 		= _G.math;
 local cos, deg, rad, sin = math.cos, math.deg, math.rad, math.sin;
 local hooksecurefunc = _G.hooksecurefunc;
diff --git a/SVUI_Auras/SVUI_Auras.lua b/SVUI_Auras/SVUI_Auras.lua
index 18bca72..a3925d2 100644
--- a/SVUI_Auras/SVUI_Auras.lua
+++ b/SVUI_Auras/SVUI_Auras.lua
@@ -16,7 +16,6 @@ local error     = _G.error;
 local pcall     = _G.pcall;
 local tostring  = _G.tostring;
 local tonumber  = _G.tonumber;
-local tinsert 	= _G.tinsert;
 local string 	= _G.string;
 local math 		= _G.math;
 local table 	= _G.table;
diff --git a/SVUI_Auras/components/procs.lua b/SVUI_Auras/components/procs.lua
index ce70d41..9e5f239 100644
--- a/SVUI_Auras/components/procs.lua
+++ b/SVUI_Auras/components/procs.lua
@@ -16,7 +16,6 @@ local error     = _G.error;
 local pcall     = _G.pcall;
 local tostring  = _G.tostring;
 local tonumber  = _G.tonumber;
-local tinsert 	= _G.tinsert;
 local string 	= _G.string;
 local math 		= _G.math;
 local table 	= _G.table;
diff --git a/SVUI_Chat/SVUI_Chat.lua b/SVUI_Chat/SVUI_Chat.lua
index e660f97..971f641 100644
--- a/SVUI_Chat/SVUI_Chat.lua
+++ b/SVUI_Chat/SVUI_Chat.lua
@@ -500,17 +500,24 @@ do
 			return
 		end
 		local ebName = self:GetName();
-		for i = 1, #EB_HISTORY[ebName] do
-			if EB_HISTORY[ebName][i] == text then
+		local frameHistory = EB_HISTORY[ebName];
+		local histCount = #frameHistory;
+		for i=1,histCount do
+			if frameHistory[i] == text then
 				EBH_LINE[ebName] = i + 1
 				return
 			end
 		end
-		tinsert(EB_HISTORY[ebName], text)
-		while(#EB_HISTORY[ebName] > self:GetHistoryLines()) do
-			tremove(EB_HISTORY[ebName], 1)
+		histCount=histCount+1;
+		frameHistory[histCount] = text;
+		local histLines = self:GetHistoryLines();
+		for i=1,histCount do
+			if i > histLines then
+				frameHistory[i] = nil;
+				histCount=histCount-1;
+			end
 		end
-		EBH_LINE[ebName] = #EB_HISTORY[ebName] + 1;
+		EBH_LINE[ebName] = histCount+1;
 	end

 	local function UpdateFromEditBoxHistory(self, increment)
@@ -1371,8 +1378,10 @@ function MOD:EnableChatHistory()
 	self:RegisterEvent("CHAT_MSG_BN_WHISPER_INFORM", "SAVE_CHAT_HISTORY")

 	local temp_cache, data_cache = {}
+	local count = 1;
 	for id, _ in pairs(self.ChatHistory) do
-		tinsert(temp_cache, tonumber(id))
+		temp_cache[count] = tonumber(id);
+		count=count+1;
 	end
 	tsort(temp_cache, function(a, b)
 		return a < b
@@ -1911,7 +1920,8 @@ function MOD:Load()
 	close:SetFrameLevel(close:GetFrameLevel() + 1);
 	close:EnableMouse(true);
 	SV.API:Set("CloseButton", close);
-	tinsert(UISpecialFrames, "SVUI_CopyChatFrame")
+	local uisfCount = #UISpecialFrames+1;
+	UISpecialFrames[uisfCount] = "SVUI_CopyChatFrame";

 	if(SV.db.Chat.saveChats) then
 		self:EnableChatHistory()
diff --git a/SVUI_FightOMatic/SVUI_FightOMatic.lua b/SVUI_FightOMatic/SVUI_FightOMatic.lua
index 0a6f5c5..1c464db 100644
--- a/SVUI_FightOMatic/SVUI_FightOMatic.lua
+++ b/SVUI_FightOMatic/SVUI_FightOMatic.lua
@@ -20,7 +20,6 @@ local assert    = _G.assert;
 local tostring  = _G.tostring;
 local tonumber  = _G.tonumber;
 local collectgarbage    = _G.collectgarbage;
-local tinsert 	= _G.tinsert;
 local string 	= _G.string;
 local math 		= _G.math;
 local table 	= _G.table;
diff --git a/SVUI_Inventory/components/organization.lua b/SVUI_Inventory/components/organization.lua
index b6c7135..87f490e 100644
--- a/SVUI_Inventory/components/organization.lua
+++ b/SVUI_Inventory/components/organization.lua
@@ -11,7 +11,6 @@ local unpack  = _G.unpack;
 local select  = _G.select;
 local pairs   = _G.pairs;
 local ipairs  = _G.ipairs;
-local tinsert   = _G.tinsert;
 local table   = _G.table;
 local match = string.match;
 --[[ TABLE METHODS ]]--
diff --git a/SVUI_Inventory/components/sorting.lua b/SVUI_Inventory/components/sorting.lua
index 760a735..206de6b 100644
--- a/SVUI_Inventory/components/sorting.lua
+++ b/SVUI_Inventory/components/sorting.lua
@@ -155,24 +155,38 @@ local scanningCache = {
 	["reagent"] = {REAGENTBANK_CONTAINER},
 	["guild"] = {51,52,53,54,55,56,57,58},
 }
-
-for i = NUM_BAG_SLOTS + 1, (NUM_BAG_SLOTS + NUM_BANKBAGSLOTS), 1 do
-  tinsert(scanningCache.bank, i)
-end
-for i = 0, NUM_BAG_SLOTS do
-  tinsert(scanningCache.bags, i)
-end
-for _,i in ipairs(scanningCache.bags) do
-  tinsert(scanningCache.all, i)
-end
-for _,i in ipairs(scanningCache.bank) do
-  tinsert(scanningCache.all, i)
+do
+	local cacheCount = 1;
+	for i = NUM_BAG_SLOTS + 1, (NUM_BAG_SLOTS + NUM_BANKBAGSLOTS), 1 do
+	  scanningCache.bank[cacheCount] = i
+		cacheCount=cacheCount+1;
+	end
 end
-for _,i in ipairs(scanningCache.reagent) do
-  tinsert(scanningCache.all, i)
+do
+	local cacheCount = 1;
+	for i = 0, NUM_BAG_SLOTS do
+	  scanningCache.bags[cacheCount] = i
+		cacheCount=cacheCount+1;
+	end
 end
-for _,i in ipairs(scanningCache.guild) do
-  tinsert(scanningCache.all, i)
+do
+	local cacheCount = 1;
+	for _,i in ipairs(scanningCache.bags) do
+		scanningCache.all[cacheCount] = i
+		cacheCount=cacheCount+1;
+	end
+	for _,i in ipairs(scanningCache.bank) do
+		scanningCache.all[cacheCount] = i
+		cacheCount=cacheCount+1;
+	end
+	for _,i in ipairs(scanningCache.reagent) do
+		scanningCache.all[cacheCount] = i
+		cacheCount=cacheCount+1;
+	end
+	for _,i in ipairs(scanningCache.guild) do
+		scanningCache.all[cacheCount] = i
+		cacheCount=cacheCount+1;
+	end
 end
 --[[
 ##########################################################
@@ -337,8 +351,10 @@ end
 local function GetSortingGroup(id)
 	if match(id, "^[-%d,]+$") then
 		local bags = {}
+		local count = 1;
 		for b in gmatch(id, "-?%d+") do
-			tinsert(bags, tonumber(b))
+			bags[count] = tonumber(b);
+			count=count+1;
 		end
 		return bags
 	end
@@ -454,7 +470,8 @@ EXTERNAL SORTING CALLS
 do
 	local function SetSortingPath(source, target)
 		UpdateLocation(source, target)
-		tinsert(sortingCache[6], 1, (MoveEncoder(source, target)))
+		local move=MoveEncoder(source, target);
+		tinsert(sortingCache[6], 1, move)
 	end

 	local function IsPartial(bag, slot)