Quantcast

5.0.85

Steven Jackson [10-22-14 - 04:24]
5.0.85
Filename
Interface/AddOns/SVUI/packages/unit/SVUnit.lua
Interface/AddOns/SVUI/packages/unit/SVUnit.xml
Interface/AddOns/SVUI/packages/unit/elements/essentials.lua
Interface/AddOns/SVUI/packages/unit/frames.lua
Interface/AddOns/SVUI/packages/unit/groups.lua
Interface/AddOns/SVUI/packages/unit/view.lua
Interface/AddOns/SVUI/xml/widgets.xml
Interface/AddOns/SVUI_ConfigOMatic/components/units/grid.lua
Interface/AddOns/SVUI_ConfigOMatic/components/units/other.lua
Interface/AddOns/SVUI_ConfigOMatic/components/units/party.lua
Interface/AddOns/SVUI_ConfigOMatic/components/units/raid.lua
Interface/AddOns/SVUI_FightOMatic/SVUI_FightOMatic.lua
Interface/AddOns/SVUI_TrackOMatic/SVUI_TrackOMatic.lua
Interface/AddOns/SVUI_TrackOMatic/SVUI_TrackOMatic.xml
Interface/AddOns/SVUI_TrackOMatic/components/triangulate.lua
diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua
index 6f13e07..1619fe5 100644
--- a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua
+++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua
@@ -229,14 +229,13 @@ do
 	end
 end

-function MOD:GetActiveSize(db)
+function MOD:GetActiveSize(db, token)
 	local width, height, best = 0,0,0
-
 	if(SV.db.SVUnit.grid.enable and db.gridAllowed) then
 		width = SV.db.SVUnit.grid.size
 		height = width
 		best = width
-	else
+	elseif(db) then
 		width = db.width
 		height = db.height
 		best = min(width, height);
@@ -245,70 +244,6 @@ function MOD:GetActiveSize(db)
 	return width, height, best
 end

-function MOD:AllowElement(unitFrame)
-	if InCombatLockdown() then return; end
-	if not unitFrame.isForced then
-		unitFrame.sourceElement = unitFrame.unit;
-		unitFrame.unit = "player"
-		unitFrame.isForced = true;
-		unitFrame.sourceEvent = unitFrame:GetScript("OnUpdate")
-	end
-
-	unitFrame:SetScript("OnUpdate", nil)
-	unitFrame.forceShowAuras = true;
-	UnregisterUnitWatch(unitFrame)
-	RegisterUnitWatch(unitFrame, true)
-
-	unitFrame:Show()
-	if unitFrame:IsVisible() and unitFrame.Update then
-		unitFrame:Update()
-	end
-end
-
-function MOD:RestrictElement(unitFrame)
-	if(InCombatLockdown() or (not unitFrame.isForced)) then return; end
-
-	unitFrame.forceShowAuras = nil
-	unitFrame.isForced = nil
-
-	UnregisterUnitWatch(unitFrame)
-	RegisterUnitWatch(unitFrame)
-
-	if unitFrame.sourceEvent then
-		unitFrame:SetScript("OnUpdate", unitFrame.sourceEvent)
-		unitFrame.sourceEvent = nil
-	end
-
-	unitFrame.unit = unitFrame.sourceElement or unitFrame.unit;
-
-	if unitFrame:IsVisible() and unitFrame.Update then
-		unitFrame:Update()
-	end
-end
-
-function MOD:AllowChildren(parentFrame, ...)
-	parentFrame.isForced = true;
-
-	for i=1, select("#", ...) do
-		local childFrame = select(i, ...)
-		childFrame:RegisterForClicks(nil)
-		childFrame:SetID(i)
-		childFrame.TargetGlow:SetAlpha(0)
-		self:AllowElement(childFrame)
-	end
-end
-
-function MOD:RestrictChildren(parentFrame, ...)
-	parentFrame.isForced = nil;
-
-	for i=1,select("#",...) do
-		local childFrame = select(i,...)
-		childFrame:RegisterForClicks(SV.db.SVUnit.fastClickTarget and 'AnyDown' or 'AnyUp')
-		childFrame.TargetGlow:SetAlpha(1)
-		self:RestrictElement(childFrame)
-	end
-end
-
 function MOD:ResetUnitOptions(unit)
 	SV:ResetData("SVUnit", unit)
 	self:RefreshUnitFrames()
@@ -380,8 +315,8 @@ function MOD:RefreshUnitFrames()

 	for _,group in pairs(self.Headers) do
 		group:Update()
-		if group.SetConfigEnvironment then
-		  group:SetConfigEnvironment()
+		if(group.Configure) then
+		  group:Configure()
 		end
 	end
 	if SV.db.SVUnit.disableBlizzard then
@@ -478,7 +413,7 @@ end

 function MOD:RefreshUnitLayout(frame, template)
 	local db = SV.db.SVUnit[template]
-
+	if(not db) then return end
 	local TOP_ANCHOR1, TOP_ANCHOR2, TOP_MODIFIER = "TOPRIGHT", "TOPLEFT", 1;
 	local BOTTOM_ANCHOR1, BOTTOM_ANCHOR2, BOTTOM_MODIFIER = "BOTTOMLEFT", "BOTTOMRIGHT", -1;
 	if(ReversedUnit[template]) then
@@ -1196,179 +1131,6 @@ function MOD:RefreshUnitLayout(frame, template)
 end
 --[[
 ##########################################################
-LOCAL VARIABLES
-##########################################################
-]]--
-local definedEnvs,tags = {}, {};
-local CharacterSelect = {"Munglunch", "Elv", "Tukz", "Azilroka", "Sortokk", "AlleyKat", "Quokka", "Haleth", "P3lim", "Haste", "Totalpackage", "Kryso", "Thepilli", "Doonga", "Judicate", "Cazart506", "Movster", "MuffinMonster", "Joelsoul", "Trendkill09", "Luamar", "Zharooz", "Lyn3x5", "Madh4tt3r", "Xarioth", "Sinnisterr", "Melonmaniac", "Hojowameeat", "Xandeca", "Bkan", "Daigan", "AtomicKiller", "Meljen", "Moondoggy", "Stormblade", "Schreibstift", "Anj", "Risien", "", ""};
-local _PROXY;
-local _ENV = {
-	UnitPower = function(unit, g)
-		if unit:find('target') or unit:find('focus') then
-			return UnitPower(unit, g)
-		end
-		return random(1, UnitPowerMax(unit, g)or 1)
-	end,
-	UnitHealth = function(unit)
-		if unit:find('target') or unit:find('focus') then
-			return UnitHealth(unit)
-		end
-		return random(1, UnitHealthMax(unit))
-	end,
-	UnitName = function(unit)
-		if unit:find('target') or unit:find('focus') then
-			return UnitName(unit)
-		end
-		local randomSelect = random(1, 40)
-		local name = CharacterSelect[randomSelect];
-		return name
-	end,
-	UnitClass = function(unit)
-		if unit:find('target') or unit:find('focus') then
-			return UnitClass(unit)
-		end
-		local token = CLASS_SORT_ORDER[random(1, #(CLASS_SORT_ORDER))]
-		return LOCALIZED_CLASS_NAMES_MALE[token], token
-	end,
-	Hex = function(r, g, b)
-		if type(r) == "table" then
-			if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
-		end
-		return format("|cff%02x%02x%02x", r*255, g*255, b*255)
-	end,
-	ColorGradient = oUF_Villain.ColorGradient,
-};
---[[
-##########################################################
-GROUP CONFIG VISIBILITY
-##########################################################
-]]--
-local function SetProxyEnv()
-	if(_PROXY ~= nil) then return end
-	_PROXY = setmetatable(_ENV, {__index = _G, __newindex = function(_,key,value) _G[key]=value end});
-	tags['name:color'] = oUF_Villain.Tags.Methods['name:color']
-	for i=1, 30 do
-		tags['name:'..i] = oUF_Villain.Tags.Methods['name:'..i]
-	end
-	tags['name:grid'] = oUF_Villain.Tags.Methods['name:grid']
-	tags['health:color'] = oUF_Villain.Tags.Methods['health:color']
-	tags['health:current'] = oUF_Villain.Tags.Methods['health:current']
-	tags['health:deficit'] = oUF_Villain.Tags.Methods['health:deficit']
-	tags['health:curpercent'] = oUF_Villain.Tags.Methods['health:curpercent']
-	tags['health:curmax'] = oUF_Villain.Tags.Methods['health:curmax']
-	tags['health:curmax-percent'] = oUF_Villain.Tags.Methods['health:curmax-percent']
-	tags['health:max'] = oUF_Villain.Tags.Methods['health:max']
-	tags['health:percent'] = oUF_Villain.Tags.Methods['health:percent']
-	tags['power:color'] = oUF_Villain.Tags.Methods['power:color']
-	tags['power:current'] = oUF_Villain.Tags.Methods['power:current']
-	tags['power:deficit'] = oUF_Villain.Tags.Methods['power:deficit']
-	tags['power:curpercent'] = oUF_Villain.Tags.Methods['power:curpercent']
-	tags['power:curmax'] = oUF_Villain.Tags.Methods['power:curmax']
-	tags['power:curmax-percent'] = oUF_Villain.Tags.Methods['power:curmax-percent']
-	tags['power:max'] = oUF_Villain.Tags.Methods['power:max']
-	tags['power:percent'] = oUF_Villain.Tags.Methods['power:percent']
-end
-
-local function ChangeGroupIndex(self)
-	if not self:GetParent().forceShow and not self.forceShow then return end
-	if not self:IsShown() then return end
-
-	local max = MAX_RAID_MEMBERS;
-	local key = self.___groupkey
-	local db = SV.db.SVUnit[key]
-
-	local newIndex = db.customSorting and -(min(db.groupCount * (db.gRowCol * 5), max) + 1 ) or -4;
-	if self:GetAttribute("startingIndex") ~= newIndex then
-		self:SetAttribute("startingIndex", newIndex)
-		self.isForced = true;
-		MOD:AllowChildren(self, self:GetChildren())
-	end
-end
-
-function MOD:ViewEnemyFrames(unit, numGroup)
-	if InCombatLockdown()then return end
-	for i=1, numGroup do
-		local unitName = unit..i
-		local frame = self.Units[unitName]
-		if(frame) then
-			if(not frame.isForced) then
-				self:AllowElement(frame)
-			else
-				self:RestrictElement(frame)
-			end
-		end
-	end
-end
-
-local attrOverride = {
-	["showRaid"] = true,
-	["showParty"] = true,
-	["showSolo"] = true
-}
-
-function MOD:ViewGroupFrames(headerFrame, setForced)
-	if InCombatLockdown() then return end
-
-	SetProxyEnv()
-	local key = headerFrame.___groupkey
-	local db = SV.db.SVUnit[key]
-	headerFrame.forceShow = setForced;
-	headerFrame.forceShowAuras = setForced;
-	headerFrame.isForced = setForced;
-
-	if setForced then
-		for _, func in pairs(tags) do
-			if type(func) == "function" then
-				if not definedEnvs[func] then
-					definedEnvs[func] = getfenv(func)
-					setfenv(func, _PROXY)
-				end
-			end
-		end
-		RegisterStateDriver(headerFrame, "visibility", "show")
-	else
-		for func, fenv in pairs(definedEnvs)do
-			setfenv(func, fenv)
-			definedEnvs[func] = nil
-		end
-		RegisterStateDriver(headerFrame, "visibility", db.visibility)
-		local eventScript = headerFrame:GetScript("OnEvent")
-		if eventScript then
-			eventScript(headerFrame, "PLAYER_ENTERING_WORLD")
-		end
-	end
-
-	for i = 1, #headerFrame.groups do
-		local groupFrame = headerFrame.groups[i]
-
-		if groupFrame:IsShown()then
-			groupFrame.forceShow = headerFrame.forceShow;
-			groupFrame.forceShowAuras = headerFrame.forceShowAuras;
-			groupFrame:HookScript("OnAttributeChanged", ChangeGroupIndex)
-			if setForced then
-				for attr in pairs(attrOverride)do
-					groupFrame:SetAttribute(attr, nil)
-				end
-
-				ChangeGroupIndex(groupFrame)
-				groupFrame:Update()
-			else
-				for attr in pairs(attrOverride)do
-					groupFrame:SetAttribute(attr, true)
-				end
-
-				self:RestrictChildren(groupFrame, groupFrame:GetChildren())
-				groupFrame:SetAttribute("startingIndex", 1)
-				groupFrame:Update()
-			end
-		end
-	end
-
-	headerFrame:SetActiveState()
-	collectgarbage("collect")
-end
---[[
-##########################################################
 EVENTS AND INITIALIZE
 ##########################################################
 ]]--
@@ -1381,18 +1143,18 @@ function MOD:FrameForge()
 		self:SetUnitFrame("targettarget")
 		self:SetUnitFrame("focus")
 		self:SetUnitFrame("focustarget")
-		self:SetEnemyFrames("boss", MAX_BOSS_FRAMES)
-		self:SetEnemyFrames("arena", 5)
+		self:SetEnemyFrame("boss", MAX_BOSS_FRAMES)
+		self:SetEnemyFrame("arena", 5)
 		LoadedUnitFrames = true;
 	end
 	if not LoadedGroupHeaders then
 		self:SetGroupFrame("raid10")
 		self:SetGroupFrame("raid25")
 		self:SetGroupFrame("raid40")
-		self:SetGroupFrame("raidpet", nil, "SVUI_UNITPET", nil, "SecureGroupPetHeaderTemplate")
-		self:SetGroupFrame("party", nil, "SVUI_UNITPET, SVUI_UNITTARGET")
-		self:SetGroupFrame("tank", "MAINTANK", "SVUI_UNITTARGET")
-		self:SetGroupFrame("assist", "MAINASSIST", "SVUI_UNITTARGET")
+		self:SetGroupFrame("raidpet")
+		self:SetGroupFrame("party")
+		self:SetGroupFrame("tank")
+		self:SetGroupFrame("assist")
 		LoadedGroupHeaders = true
 	end
 end
@@ -1412,13 +1174,13 @@ end
 function MOD:PLAYER_REGEN_DISABLED()
 	for _,frame in pairs(self.Headers) do
 		if frame and frame.forceShow then
-			self:UpdateGroupConfig(frame)
+			self:ViewGroupFrames(frame)
 		end
 	end

 	for _,frame in pairs(self.Units) do
-		if frame and frame.forceShow then
-			self:RestrictElement(frame)
+		if(frame and frame.forceShow and frame.Restrict) then
+			frame:Restrict()
 		end
 	end
 end
diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.xml b/Interface/AddOns/SVUI/packages/unit/SVUnit.xml
index a8bbb31..3b1d8cc 100644
--- a/Interface/AddOns/SVUI/packages/unit/SVUnit.xml
+++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.xml
@@ -61,4 +61,6 @@
     <Script file="resources\warrior.lua"/>

     <Script file="frames.lua"/>
+    <Script file="groups.lua"/>
+    <Script file="view.lua"/>
 </Ui>
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua b/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua
index 1588993..17f5170 100644
--- a/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua
+++ b/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua
@@ -673,7 +673,7 @@ end
 PORTRAIT
 ##########################################################
 ]]--
-function MOD:CreatePortrait(frame, smallUnit, isPlayer)
+function MOD:CreatePortrait(frame,smallUnit,isPlayer)
 	-- 3D Portrait
 	local portrait3D = CreateFrame("PlayerModel",nil,frame)
 	portrait3D:SetFrameStrata("LOW")
diff --git a/Interface/AddOns/SVUI/packages/unit/frames.lua b/Interface/AddOns/SVUI/packages/unit/frames.lua
index 8437d72..a478285 100644
--- a/Interface/AddOns/SVUI/packages/unit/frames.lua
+++ b/Interface/AddOns/SVUI/packages/unit/frames.lua
@@ -21,6 +21,7 @@ local type          = type;
 local rawset        = rawset;
 local rawget        = rawget;
 local tostring      = tostring;
+local tonumber      = tonumber;
 local error         = error;
 local next          = next;
 local pcall         = pcall;
@@ -62,68 +63,8 @@ if(not MOD) then return end
 LOCAL DATA
 ##########################################################
 ]]--
-local CONSTRUCTORS, GROUP_UPDATES = {}, {}
+local CONSTRUCTORS = {}
 local lastArenaFrame, lastBossFrame
-local sortMapping = {
-    ["DOWN_RIGHT"] = {[1]="TOP",[2]="TOPLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=-1,[8]=false},
-    ["DOWN_LEFT"] = {[1]="TOP",[2]="TOPRIGHT",[3]="RIGHT",[4]="LEFT",[5]="RIGHT",[6]=1,[7]=-1,[8]=false},
-    ["UP_RIGHT"] = {[1]="BOTTOM",[2]="BOTTOMLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=1,[8]=false},
-    ["UP_LEFT"] = {[1]="BOTTOM",[2]="BOTTOMRIGHT",[3]="RIGHT",[4]="LEFT",[5]="RIGHT",[6]=-1,[7]=1,[8]=false},
-    ["RIGHT_DOWN"] = {[1]="LEFT",[2]="TOPLEFT",[3]="TOP",[4]="BOTTOM",[5]="TOP",[6]=1,[7]=-1,[8]=true},
-    ["RIGHT_UP"] = {[1]="LEFT",[2]="BOTTOMLEFT",[3]="BOTTOM",[4]="TOP",[5]="BOTTOM",[6]=1,[7]=1,[8]=true},
-    ["LEFT_DOWN"] = {[1]="RIGHT",[2]="TOPRIGHT",[3]="TOP",[4]="BOTTOM",[5]="TOP",[6]=-1,[7]=-1,[8]=true},
-    ["LEFT_UP"] = {[1]="RIGHT",[2]="BOTTOMRIGHT",[3]="BOTTOM",[4]="TOP",[5]="BOTTOM",[6]=-1,[7]=1,[8]=true},
-    ["UP"] = {[1]="BOTTOM",[2]="BOTTOM",[3]="BOTTOM",[4]="TOP",[5]="TOP",[6]=1,[7]=1,[8]=false},
-    ["DOWN"] = {[1]="TOP",[2]="TOP",[3]="TOP",[4]="BOTTOM",[5]="BOTTOM",[6]=1,[7]=1,[8]=false},
-}
-local GroupDistributor = {
-    ["CLASS"] = function(x)
-        x:SetAttribute("groupingOrder","DEATHKNIGHT,DRUID,HUNTER,MAGE,PALADIN,PRIEST,SHAMAN,WARLOCK,WARRIOR,MONK")
-        x:SetAttribute("sortMethod","NAME")
-        x:SetAttribute("groupBy","CLASS")
-    end,
-    ["MTMA"] = function(x)
-        x:SetAttribute("groupingOrder","MAINTANK,MAINASSIST,NONE")
-        x:SetAttribute("sortMethod","NAME")
-        x:SetAttribute("groupBy","ROLE")
-    end,
-    ["ROLE_TDH"] = function(x)
-        x:SetAttribute("groupingOrder","TANK,DAMAGER,HEALER,NONE")
-        x:SetAttribute("sortMethod","NAME")
-        x:SetAttribute("groupBy","ASSIGNEDROLE")
-    end,
-    ["ROLE_HTD"] = function(x)
-        x:SetAttribute("groupingOrder","HEALER,TANK,DAMAGER,NONE")
-        x:SetAttribute("sortMethod","NAME")
-        x:SetAttribute("groupBy","ASSIGNEDROLE")
-    end,
-    ["ROLE_HDT"] = function(x)
-        x:SetAttribute("groupingOrder","HEALER,DAMAGER,TANK,NONE")
-        x:SetAttribute("sortMethod","NAME")
-        x:SetAttribute("groupBy","ASSIGNEDROLE")
-    end,
-    ["ROLE"] = function(x)
-        x:SetAttribute("groupingOrder","TANK,HEALER,DAMAGER,NONE")
-        x:SetAttribute("sortMethod","NAME")
-        x:SetAttribute("groupBy","ASSIGNEDROLE")
-    end,
-    ["NAME"] = function(x)
-        x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8")
-        x:SetAttribute("sortMethod","NAME")
-        x:SetAttribute("groupBy",nil)
-    end,
-    ["GROUP"] = function(x)
-        x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8")
-        x:SetAttribute("sortMethod","INDEX")
-        x:SetAttribute("groupBy","GROUP")
-    end,
-    ["PETNAME"] = function(x)
-        x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8")
-        x:SetAttribute("sortMethod","NAME")
-        x:SetAttribute("groupBy", nil)
-        x:SetAttribute("filterOnPet", true)
-    end
-}
 --[[
 ##########################################################
 ALL UNIT HELPERS
@@ -153,10 +94,50 @@ local UpdateTargetGlow = function(self)
         self.TargetGlow:Hide()
     end
 end
+
+local AllowElement = function(self)
+    if InCombatLockdown() then return; end
+
+    if not self.isForced then
+        self.sourceElement = self.unit;
+        self.unit = "player"
+        self.isForced = true;
+        self.sourceEvent = self:GetScript("OnUpdate")
+    end
+
+    self:SetScript("OnUpdate", nil)
+    self.forceShowAuras = true;
+    UnregisterUnitWatch(self)
+    RegisterUnitWatch(self, true)
+
+    self:Show()
+    if self:IsVisible() and self.Update then
+        self:Update()
+    end
+end
+
+local RestrictElement = function(self)
+    if(InCombatLockdown() or (not self.isForced)) then return; end
+
+    self.forceShowAuras = nil
+    self.isForced = nil
+
+    UnregisterUnitWatch(self)
+    RegisterUnitWatch(self)
+
+    if self.sourceEvent then
+        self:SetScript("OnUpdate", self.sourceEvent)
+        self.sourceEvent = nil
+    end
+
+    self.unit = self.sourceElement or self.unit;
+
+    if self:IsVisible() and self.Update then
+        self:Update()
+    end
+end
 --[[
 ##########################################################
-STANDARD UNITS
-##########################################################
 PLAYER
 ##########################################################
 ]]--
@@ -765,6 +746,10 @@ CONSTRUCTORS["boss"] = function(self, unit)
     self.Castbar = MOD:CreateCastbar(self, true, nil, true, nil, true)
     self.RaidIcon = MOD:CreateRaidIcon(self)
     self.AltPowerBar = MOD:CreateAltPowerBar(self)
+
+    self.Restrict = RestrictElement
+    self.Allow = AllowElement
+
     self.Range = { insideAlpha = 1, outsideAlpha = 1 }
     self:SetAttribute("type2", "focus")

@@ -785,50 +770,6 @@ end
 ARENA
 ##########################################################
 ]]--
-local function CreatePrepFrame(frameName, parentFrame, parentID)
-    local prep = CreateFrame("Frame", frameName, UIParent)
-    prep:SetFrameStrata("MEDIUM")
-    prep:SetAllPoints(parentFrame)
-    prep:SetID(parentID)
-    prep:SetPanelTemplate("Bar", true, 3, 1, 1)
-
-    local health = CreateFrame("StatusBar", nil, prep)
-    health:SetAllPoints(prep)
-    health:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]])
-    prep.Health = health
-
-    local icon = CreateFrame("Frame", nil, prep)
-    icon:SetSize(45,45)
-    icon:SetPoint("LEFT", prep, "RIGHT", 2, 0)
-    icon:SetBackdrop({
-        bgFile = [[Interface\BUTTONS\WHITE8X8]],
-        tile = false,
-        tileSize = 0,
-        edgeFile = [[Interface\BUTTONS\WHITE8X8]],
-        edgeSize = 2,
-        insets = {
-            left = 0,
-            right = 0,
-            top = 0,
-            bottom = 0
-        }
-    })
-    icon:SetBackdropColor(0, 0, 0, 0)
-    icon:SetBackdropBorderColor(0, 0, 0)
-    icon.Icon = icon:CreateTexture(nil, "OVERLAY")
-    icon.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
-    icon.Icon:FillInner(icon, 2, 2)
-    prep.SpecIcon = icon
-
-    local text = prep.Health:CreateFontString(nil, "OVERLAY")
-    text:SetFont(SV.Media.font.names, 16, "OUTLINE")
-    text:SetTextColor(1, 1, 1)
-    text:SetPoint("CENTER")
-    prep.SpecClass = text
-
-    prep:Hide()
-end
-
 local UpdateArenaFrame = function(self)
     local db = SV.db.SVUnit["arena"]
     local INDEX = self:GetID() or 1;
@@ -933,7 +874,52 @@ CONSTRUCTORS["arena"] = function(self, unit)
     self.Range = { insideAlpha = 1, outsideAlpha = 1 }
     self:SetAttribute("type2", "focus")

-    if(not _G[prepName]) then CreatePrepFrame(prepName, self, selfID) end
+    self.Restrict = RestrictElement
+    self.Allow = AllowElement
+
+    if(not _G[prepName]) then
+        local prep = CreateFrame("Frame", prepName, UIParent)
+        prep:SetFrameStrata("MEDIUM")
+        prep:SetAllPoints(self)
+        prep:SetID(selfID)
+        prep:SetPanelTemplate("Bar", true, 3, 1, 1)
+
+        local health = CreateFrame("StatusBar", nil, prep)
+        health:SetAllPoints(prep)
+        health:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]])
+        prep.Health = health
+
+        local icon = CreateFrame("Frame", nil, prep)
+        icon:SetSize(45,45)
+        icon:SetPoint("LEFT", prep, "RIGHT", 2, 0)
+        icon:SetBackdrop({
+            bgFile = [[Interface\BUTTONS\WHITE8X8]],
+            tile = false,
+            tileSize = 0,
+            edgeFile = [[Interface\BUTTONS\WHITE8X8]],
+            edgeSize = 2,
+            insets = {
+                left = 0,
+                right = 0,
+                top = 0,
+                bottom = 0
+            }
+        })
+        icon:SetBackdropColor(0, 0, 0, 0)
+        icon:SetBackdropBorderColor(0, 0, 0)
+        icon.Icon = icon:CreateTexture(nil, "OVERLAY")
+        icon.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
+        icon.Icon:FillInner(icon, 2, 2)
+        prep.SpecIcon = icon
+
+        local text = prep.Health:CreateFontString(nil, "OVERLAY")
+        text:SetFont(SV.Media.font.names, 16, "OUTLINE")
+        text:SetTextColor(1, 1, 1)
+        text:SetPoint("CENTER")
+        prep.SpecClass = text
+
+        prep:Hide()
+    end

     if(not _G["SVUI_Arena_MOVE"]) then
         self:Point("RIGHT", SV.UIParent, "RIGHT", -105, 0)
@@ -1051,7 +1037,7 @@ function MOD:SetUnitFrame(key)
     end
 end

-function MOD:SetEnemyFrames(key, maxCount)
+function MOD:SetEnemyFrame(key, maxCount)
     if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end
     for i = 1, maxCount do
         local unit = key..i
@@ -1071,7 +1057,7 @@ function MOD:SetEnemyFrames(key, maxCount)
             frame:SetParent(SVUI_UnitFrameParent)
         end
         if frame.isForced then
-            self:AllowElement(frame)
+            frame:Allow()
         end
         if(SV.db.SVUnit.enable and SV.db.SVUnit[key].enable) then
             frame:Enable()
@@ -1080,1050 +1066,4 @@ function MOD:SetEnemyFrames(key, maxCount)
             frame:Disable()
         end
     end
-end
---[[
-##########################################################
-HEADER UNITS
-##########################################################
-HEADER FRAME HELPERS
-##########################################################
-]]--
-local GroupMediaUpdate = function(self)
-    local key = self.___groupkey
-    local index = 1;
-    local childFrame = self:GetAttribute("child"..index)
-    while childFrame do
-        MOD.RefreshUnitMedia(childFrame, key)
-        if(_G[childFrame:GetName().."Pet"]) then
-            MOD.RefreshUnitMedia(_G[childFrame:GetName().."Pet"], key)
-        end
-        if(_G[childFrame:GetName().."Target"]) then
-            MOD.RefreshUnitMedia(_G[childFrame:GetName().."Target"], key)
-        end
-        childFrame:UpdateAllElements()
-        index = index + 1;
-        childFrame = self:GetAttribute("child"..index)
-    end
-end
-
-local DetachSubFrames = function(...)
-    for i = 1, select("#", ...) do
-        local frame = select(i,...)
-        frame:ClearAllPoints()
-    end
-end
---[[
-##########################################################
-RAID 10, 25, 40
-##########################################################
-]]--
-local Raid10Visibility = function(self, event)
-    local db = SV.db.SVUnit["raid10"]
-    if (not db or (db and not db.enable) or (SV.db.SVUnit and not SV.db.SVUnit.smartRaidFilter) or self.isForced) then return end
-
-    local instance, instanceType = IsInInstance()
-    if(event == "PLAYER_REGEN_ENABLED") then
-        self:UnregisterEvent("PLAYER_REGEN_ENABLED")
-    end
-    if not InCombatLockdown() then
-        if(instance and (instanceType == "raid")) then
-            UnregisterStateDriver(self, "visibility")
-            local maxPlayers = select(5, GetInstanceInfo())
-            if((maxPlayers and maxPlayers == 10)) then
-                self:Show()
-            else
-                self:Hide()
-            end
-        elseif db.visibility then
-            RegisterStateDriver(self, "visibility", db.visibility)
-        end
-    else
-        self:RegisterEvent("PLAYER_REGEN_ENABLED")
-        return
-    end
-end
-
-local Raid25Visibility = function(self, event)
-    local db = SV.db.SVUnit["raid25"]
-    if (not db or (db and not db.enable) or (SV.db.SVUnit and not SV.db.SVUnit.smartRaidFilter) or self.isForced) then return end
-
-    local instance, instanceType = IsInInstance()
-
-    if event == "PLAYER_REGEN_ENABLED"then
-        self:UnregisterEvent("PLAYER_REGEN_ENABLED")
-    end
-    if not InCombatLockdown()then
-        if(instance and (instanceType == "raid")) then
-            UnregisterStateDriver(self, "visibility")
-            local maxPlayers = select(5, GetInstanceInfo())
-            if((maxPlayers and (maxPlayers > 10 and maxPlayers < 26))) then
-                self:Show()
-            else
-                self:Hide()
-            end
-        elseif db.visibility then
-            RegisterStateDriver(self, "visibility", db.visibility)
-        end
-    else
-        self:RegisterEvent("PLAYER_REGEN_ENABLED")
-        return
-    end
-end
-
-local Raid40Visibility = function(self, event)
-    local db = SV.db.SVUnit["raid40"]
-    if (not db or (db and not db.enable) or (SV.db.SVUnit and not SV.db.SVUnit.smartRaidFilter) or self.isForced) then return end
-
-    local instance, instanceType = IsInInstance()
-    if event == "PLAYER_REGEN_ENABLED"then
-        self:UnregisterEvent("PLAYER_REGEN_ENABLED")
-    end
-    if not InCombatLockdown()then
-        if(instance and (instanceType == "raid")) then
-            UnregisterStateDriver(self, "visibility")
-            local maxPlayers = select(5, GetInstanceInfo())
-            if((maxPlayers and maxPlayers > 25)) then
-                self:Show()
-            else
-                self:Hide()
-            end
-        elseif db.visibility then
-            RegisterStateDriver(self, "visibility", db.visibility)
-        end
-    else
-        self:RegisterEvent("PLAYER_REGEN_ENABLED")
-        return
-    end
-end
-
-local UpdateRaidSubUnit = function(self, key, db)
-    self.colors = oUF_Villain.colors;
-    self:RegisterForClicks(SV.db.SVUnit.fastClickTarget and "AnyDown" or "AnyUp")
-    local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db)
-    if not InCombatLockdown() then
-        self:Size(UNIT_WIDTH, UNIT_HEIGHT)
-    end
-    do
-        local rdBuffs = self.RaidDebuffs;
-        if db.rdebuffs.enable then
-            if not self:IsElementEnabled('RaidDebuffs')then
-                self:EnableElement("RaidDebuffs")
-            end
-            local actualSz = numMin(db.rdebuffs.size, (UNIT_HEIGHT - 8))
-            rdBuffs:Size(actualSz)
-            rdBuffs:Point("CENTER", self, "CENTER", db.rdebuffs.xOffset, db.rdebuffs.yOffset)
-            rdBuffs:Show()
-        else
-            self:DisableElement("RaidDebuffs")
-            rdBuffs:Hide()
-        end
-    end
-    MOD.RefreshUnitMedia(self, key)
-    MOD:UpdateAuraWatch(self, key)
-    MOD:RefreshUnitLayout(self, key)
-    if(key ~= "raidpet") then
-        self:EnableElement("ReadyCheck")
-    end
-    self:UpdateAllElements()
-end
-
-GROUP_UPDATES["raid10"] = function(self)
-    local frame = self:GetParent()
-    if not frame.positioned then
-        frame:ClearAllPoints()
-        frame:Point("LEFT", SV.UIParent, "LEFT", 4, 0)
-        SV.Mentalo:Add(frame, L["Raid 10 Frames"], nil, nil, nil, "ALL, RAID"..10)
-        frame:RegisterEvent("PLAYER_ENTERING_WORLD")
-        frame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
-        frame:SetScript("OnEvent", Raid10Visibility)
-        frame.positioned = true
-    end
-    Raid10Visibility(frame)
-    local key = "raid10"
-    local db = SV.db.SVUnit[key]
-    local index = 1;
-    local childFrame = self:GetAttribute("child"..index)
-    while childFrame do
-        UpdateRaidSubUnit(childFrame, key, db)
-        if(_G[childFrame:GetName().."Pet"]) then
-            UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db)
-        end
-        if(_G[childFrame:GetName().."Target"]) then
-            UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db)
-        end
-        index = index + 1;
-        childFrame = self:GetAttribute("child"..index)
-    end
-end
-
-GROUP_UPDATES["raid25"] = function(self)
-    local frame = self:GetParent()
-    if not frame.positioned then
-        frame:ClearAllPoints()
-        frame:Point("LEFT", SV.UIParent, "LEFT", 4, 0)
-        SV.Mentalo:Add(frame, L["Raid 25 Frames"], nil, nil, nil, "ALL, RAID"..25)
-        frame:RegisterEvent("PLAYER_ENTERING_WORLD")
-        frame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
-        frame:SetScript("OnEvent", Raid25Visibility)
-        frame.positioned = true
-    end
-    Raid25Visibility(frame)
-    local key = "raid25"
-    local db = SV.db.SVUnit[key]
-    local index = 1;
-    local childFrame = self:GetAttribute("child"..index)
-    while childFrame do
-        UpdateRaidSubUnit(childFrame, key, db)
-        if(_G[childFrame:GetName().."Pet"]) then
-            UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db)
-        end
-        if(_G[childFrame:GetName().."Target"]) then
-            UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db)
-        end
-        index = index + 1;
-        childFrame = self:GetAttribute("child"..index)
-    end
-end
-
-GROUP_UPDATES["raid40"] = function(self)
-    local frame = self:GetParent()
-    if not frame.positioned then
-        frame:ClearAllPoints()
-        frame:Point("LEFT", SV.UIParent, "LEFT", 4, 0)
-        SV.Mentalo:Add(frame, L["Raid 40 Frames"], nil, nil, nil, "ALL, RAID"..40)
-        frame:RegisterEvent("PLAYER_ENTERING_WORLD")
-        frame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
-        frame:SetScript("OnEvent", Raid40Visibility)
-        frame.positioned = true
-    end
-    Raid40Visibility(frame)
-    local key = "raid40"
-    local db = SV.db.SVUnit[key]
-    local index = 1;
-    local childFrame = self:GetAttribute("child"..index)
-    while childFrame do
-        UpdateRaidSubUnit(childFrame, key, db)
-        if(_G[childFrame:GetName().."Pet"]) then
-            UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db)
-        end
-        if(_G[childFrame:GetName().."Target"]) then
-            UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db)
-        end
-        index = index + 1;
-        childFrame = self:GetAttribute("child"..index)
-    end
-end
-
-local function SetRaidFrame(frame)
-    frame:SetScript("OnEnter", UnitFrame_OnEnter)
-    frame:SetScript("OnLeave", UnitFrame_OnLeave)
-
-    frame.RaidDebuffs = MOD:CreateRaidDebuffs(frame)
-    frame.Afflicted = MOD:CreateAfflicted(frame)
-    frame.ResurrectIcon = MOD:CreateResurectionIcon(frame)
-    frame.LFDRole = MOD:CreateRoleIcon(frame)
-    frame.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(frame)
-    frame.RaidIcon = MOD:CreateRaidIcon(frame)
-    frame.ReadyCheck = MOD:CreateReadyCheckIcon(frame)
-    frame.HealPrediction = MOD:CreateHealPrediction(frame)
-    frame.Range = { insideAlpha = 1, outsideAlpha = 1 }
-
-    local shadow = CreateFrame("Frame", nil, frame)
-    shadow:SetFrameLevel(1)
-    shadow:SetFrameStrata(frame:GetFrameStrata())
-    shadow:WrapOuter(frame, 3, 3)
-    shadow:SetBackdrop({
-        edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]],
-        edgeSize = 3,
-        insets = {
-            left = 5,
-            right = 5,
-            top = 5,
-            bottom = 5
-        }
-    })
-    shadow:SetBackdropColor(0, 0, 0, 0)
-    shadow:SetBackdropBorderColor(0, 0, 0, 0.9)
-    shadow:Hide()
-    frame.TargetGlow = shadow
-    tinsert(frame.__elements, UpdateTargetGlow)
-    frame:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow)
-    frame:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow)
-
-    return frame
-end
-
-CONSTRUCTORS["raid10"] = function(self, unit)
-    local key = "raid10"
-    self.unit = unit
-    self.___key = key
-    MOD:SetActionPanel(self, key)
-    self.Health = MOD:CreateHealthBar(self, true)
-    self.Health.frequentUpdates = false
-    self.Power = MOD:CreatePowerBar(self, true)
-    self.Power.frequentUpdates = false
-    self.Buffs = MOD:CreateBuffs(self, key)
-    self.Debuffs = MOD:CreateDebuffs(self, key)
-    self.AuraWatch = MOD:CreateAuraWatch(self, key)
-    return SetRaidFrame(self)
-end
-
-CONSTRUCTORS["raid25"] = function(self, unit)
-    local key = "raid25"
-    self.unit = unit
-    self.___key = key
-    MOD:SetActionPanel(self, key)
-    self.Health = MOD:CreateHealthBar(self, true)
-    self.Health.frequentUpdates = false
-    self.Power = MOD:CreatePowerBar(self, true)
-    self.Power.frequentUpdates = false
-    self.Buffs = MOD:CreateBuffs(self, key)
-    self.Debuffs = MOD:CreateDebuffs(self, key)
-    self.AuraWatch = MOD:CreateAuraWatch(self, key)
-    return SetRaidFrame(self)
-end
-
-CONSTRUCTORS["raid40"] = function(self, unit)
-    local key = "raid40"
-    self.unit = unit
-    self.___key = key
-    MOD:SetActionPanel(self, key)
-    self.Health = MOD:CreateHealthBar(self, true)
-    self.Health.frequentUpdates = false
-    self.Power = MOD:CreatePowerBar(self, true)
-    self.Power.frequentUpdates = false
-    self.Buffs = MOD:CreateBuffs(self, key)
-    self.Debuffs = MOD:CreateDebuffs(self, key)
-    self.AuraWatch = MOD:CreateAuraWatch(self, key)
-    return SetRaidFrame(self)
-end
---[[
-##########################################################
-RAID PETS
-##########################################################
-]]--
-local RaidPetVisibility = function(self, event)
-    local db = SV.db.SVUnit["raidpet"]
-    if (not db or (db and not db.enable) or (SV.db.SVUnit and not SV.db.SVUnit.smartRaidFilter) or self.isForced) then return end
-    local inInstance, instanceType = IsInInstance()
-    if event == "PLAYER_REGEN_ENABLED" then self:UnregisterEvent("PLAYER_REGEN_ENABLED") end
-
-    if not InCombatLockdown() then
-        if inInstance and instanceType == "raid" then
-            UnregisterStateDriver(self, "visibility")
-            self:Show()
-        elseif db.visibility then
-            RegisterStateDriver(self, "visibility", db.visibility)
-        end
-    else
-        self:RegisterEvent("PLAYER_REGEN_ENABLED")
-        return
-    end
-end
-
-GROUP_UPDATES["raidpet"] = function(self)
-    local raidPets = self:GetParent()
-    if not raidPets.positioned then
-        raidPets:ClearAllPoints()
-        raidPets:Point("BOTTOMLEFT", SV.UIParent, "BOTTOMLEFT", 4, 433)
-        SV.Mentalo:Add(raidPets, L["Raid Pet Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40")
-        raidPets:RegisterEvent("PLAYER_ENTERING_WORLD")
-        raidPets:RegisterEvent("ZONE_CHANGED_NEW_AREA")
-        raidPets:SetScript("OnEvent", RaidPetVisibility)
-        raidPets.positioned = true;
-    end
-    RaidPetVisibility(raidPets)
-    local key = "raidpet"
-    local db = SV.db.SVUnit[key]
-    local index = 1;
-    local childFrame = self:GetAttribute("child"..index)
-    while childFrame do
-        UpdateRaidSubUnit(childFrame, key, db)
-        if(_G[childFrame:GetName().."Pet"]) then
-            UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db)
-        end
-        if(_G[childFrame:GetName().."Target"]) then
-            UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db)
-        end
-        index = index + 1;
-        childFrame = self:GetAttribute("child"..index)
-    end
-end
-
-CONSTRUCTORS["raidpet"] = function(self, unit)
-    local key = "raidpet"
-    self.unit = unit
-    self.___key = key
-    self:SetScript("OnEnter", UnitFrame_OnEnter)
-    self:SetScript("OnLeave", UnitFrame_OnLeave)
-    MOD:SetActionPanel(self, key)
-    self.Health = MOD:CreateHealthBar(self, true)
-    self.Debuffs = MOD:CreateDebuffs(self, key)
-    self.AuraWatch = MOD:CreateAuraWatch(self, key)
-    self.RaidDebuffs = MOD:CreateRaidDebuffs(self)
-    self.Afflicted = MOD:CreateAfflicted(self)
-    self.RaidIcon = MOD:CreateRaidIcon(self)
-    self.Range = { insideAlpha = 1, outsideAlpha = 1 }
-
-    local shadow = CreateFrame("Frame", nil, self)
-    shadow:SetFrameLevel(1)
-    shadow:SetFrameStrata(self:GetFrameStrata())
-    shadow:WrapOuter(self, 3, 3)
-    shadow:SetBackdrop({
-        edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]],
-        edgeSize = 3,
-        insets = {
-            left = 5,
-            right = 5,
-            top = 5,
-            bottom = 5
-        }
-    })
-    shadow:SetBackdropColor(0, 0, 0, 0)
-    shadow:SetBackdropBorderColor(0, 0, 0, 0.9)
-    shadow:Hide()
-    self.TargetGlow = shadow
-    tinsert(self.__elements, UpdateTargetGlow)
-
-    self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow)
-    self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow)
-    return self
-end
---[[
-##########################################################
-PARTY
-##########################################################
-]]--
-local PartyVisibility = function(self, event)
-    local db = SV.db.SVUnit["party"]
-    if (not db or (db and not db.enable) or (SV.db.SVUnit and not SV.db.SVUnit.smartRaidFilter) or self.isForced) then return end
-    local instance, instanceType = IsInInstance()
-    if(event == "PLAYER_REGEN_ENABLED") then
-        self:UnregisterEvent("PLAYER_REGEN_ENABLED")
-    end
-    if(not InCombatLockdown()) then
-        if(instance and instanceType == "raid") then
-            UnregisterStateDriver(self,"visibility")
-            self:Hide()
-        elseif db.visibility then
-            RegisterStateDriver(self, "visibility", db.visibility)
-        end
-    else
-        self:RegisterEvent("PLAYER_REGEN_ENABLED")
-    end
-end
-
-local UpdatePartySubUnit = function(self, key, db)
-    self.colors = oUF_Villain.colors;
-    self:RegisterForClicks(SV.db.SVUnit.fastClickTarget and 'AnyDown' or 'AnyUp')
-    MOD.RefreshUnitMedia(self, key)
-    if self.isChild then
-        local altDB = db.petsGroup;
-        if self == _G[self.originalParent:GetName()..'Target'] then
-            altDB = db.targetsGroup
-        end
-        if not self.originalParent.childList then
-            self.originalParent.childList = {}
-        end
-        self.originalParent.childList[self] = true;
-        if not InCombatLockdown()then
-            if altDB.enable then
-                local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(altDB)
-                self:SetParent(self.originalParent)
-                self:Size(UNIT_WIDTH, UNIT_HEIGHT)
-                self:ClearAllPoints()
-                SV:ReversePoint(self, altDB.anchorPoint, self.originalParent, altDB.xOffset, altDB.yOffset)
-            else
-                self:SetParent(SV.Cloaked)
-            end
-        end
-        do
-            local health = self.Health;
-            health.Smooth = nil;
-            health.frequentUpdates = nil;
-            health.colorSmooth = nil;
-            health.colorHealth = nil;
-            health.colorClass = true;
-            health.colorReaction = true;
-            health:ClearAllPoints()
-            health:Point("TOPRIGHT", self, "TOPRIGHT", -1, -1)
-            health:Point("BOTTOMLEFT", self, "BOTTOMLEFT", 1, 1)
-        end
-        do
-            local nametext = self.InfoPanel.Name
-            self:Tag(nametext, altDB.tags)
-        end
-    else
-        if not InCombatLockdown() then
-            local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db)
-            self:Size(UNIT_WIDTH, UNIT_HEIGHT)
-        end
-        MOD:RefreshUnitLayout(self, key)
-        MOD:UpdateAuraWatch(self, key)
-    end
-    self:EnableElement('ReadyCheck')
-    self:UpdateAllElements()
-end
-
-GROUP_UPDATES["party"] = function(self)
-    local group = self:GetParent()
-    if not group.positioned then
-        group:ClearAllPoints()
-        group:Point("LEFT",SV.UIParent,"LEFT",40,0)
-        SV.Mentalo:Add(group, L['Party Frames'], nil, nil, nil, 'ALL,PARTY,ARENA');
-        group:RegisterEvent("PLAYER_ENTERING_WORLD")
-        group:RegisterEvent("ZONE_CHANGED_NEW_AREA")
-        group:SetScript("OnEvent", PartyVisibility)
-        group.positioned = true;
-    end
-    PartyVisibility(group)
-    local key = "party"
-    local db = SV.db.SVUnit[key]
-    local index = 1;
-    local childFrame = self:GetAttribute("child"..index)
-
-    while childFrame do
-        UpdatePartySubUnit(childFrame, key, db)
-        if(_G[childFrame:GetName().."Pet"]) then
-            UpdatePartySubUnit(_G[childFrame:GetName().."Pet"], key, db)
-        end
-        if(_G[childFrame:GetName().."Target"]) then
-            UpdatePartySubUnit(_G[childFrame:GetName().."Target"], key, db)
-        end
-        index = index + 1;
-        childFrame = self:GetAttribute("child"..index)
-    end
-end
-
-CONSTRUCTORS["party"] = function(self, unit)
-    local key = "party"
-    self.unit = unit
-    self.___key = key
-    self:SetScript("OnEnter", UnitFrame_OnEnter)
-    self:SetScript("OnLeave", UnitFrame_OnLeave)
-
-    MOD:SetActionPanel(self, key)
-    self.Health = MOD:CreateHealthBar(self, true)
-
-    if self.isChild then
-        self.originalParent = self:GetParent()
-    else
-        self.Power = MOD:CreatePowerBar(self, true)
-        self.Power.frequentUpdates = false
-        MOD:CreatePortrait(self, true)
-        self.Buffs = MOD:CreateBuffs(self, key)
-        self.Debuffs = MOD:CreateDebuffs(self, key)
-        self.AuraWatch = MOD:CreateAuraWatch(self, key)
-        self.Afflicted = MOD:CreateAfflicted(self)
-        self.ResurrectIcon = MOD:CreateResurectionIcon(self)
-        self.LFDRole = MOD:CreateRoleIcon(self)
-        self.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(self)
-        self.RaidIcon = MOD:CreateRaidIcon(self)
-        self.ReadyCheck = MOD:CreateReadyCheckIcon(self)
-        self.HealPrediction = MOD:CreateHealPrediction(self)
-        --self.GPS = MOD:CreateGPS(self, true)
-
-        local shadow = CreateFrame("Frame", nil, self)
-        shadow:SetFrameLevel(1)
-        shadow:SetFrameStrata(self:GetFrameStrata())
-        shadow:WrapOuter(self, 3, 3)
-        shadow:SetBackdrop({
-            edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]],
-            edgeSize = 3,
-            insets = {
-                left = 5,
-                right = 5,
-                top = 5,
-                bottom = 5
-            }
-        })
-        shadow:SetBackdropColor(0, 0, 0, 0)
-        shadow:SetBackdropBorderColor(0, 0, 0, 0.9)
-        shadow:Hide()
-        self.TargetGlow = shadow
-        tinsert(self.__elements, UpdateTargetGlow)
-        self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow)
-        self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow)
-        self:RegisterEvent("GROUP_ROSTER_UPDATE", UpdateTargetGlow)
-    end
-
-    self.Range = { insideAlpha = 1, outsideAlpha = 1 }
-    return self
-end
---[[
-##########################################################
-TANK
-##########################################################
-]]--
-local UpdateTankSubUnit = function(self, key, db)
-    self.colors = oUF_Villain.colors;
-    self:RegisterForClicks(SV.db.SVUnit.fastClickTarget and "AnyDown" or "AnyUp")
-    MOD.RefreshUnitMedia(self, key)
-    if self.isChild and self.originalParent then
-        local targets = db.targetsGroup;
-        if not self.originalParent.childList then
-            self.originalParent.childList = {}
-        end
-        self.originalParent.childList[self] = true;
-        if not InCombatLockdown()then
-            if targets.enable then
-                local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(targets)
-                self:SetParent(self.originalParent)
-                self:Size(UNIT_WIDTH, UNIT_HEIGHT)
-                self:ClearAllPoints()
-                SV:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset)
-            else
-                self:SetParent(SV.Cloaked)
-            end
-        end
-    elseif not InCombatLockdown() then
-        local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db)
-        self:Size(UNIT_WIDTH, UNIT_HEIGHT)
-    end
-    MOD:RefreshUnitLayout(self, key)
-    do
-        local nametext = self.InfoPanel.Name;
-        if oUF_Villain.colors.healthclass then
-            self:Tag(nametext, "[name:10]")
-        else
-            self:Tag(nametext, "[name:color][name:10]")
-        end
-    end
-    self:UpdateAllElements()
-end
-
-local UpdateTankFrame = function(self)
-    local key = "tank"
-    local db = SV.db.SVUnit[key]
-    if db.enable ~= true then
-        UnregisterAttributeDriver(self, "state-visibility")
-        self:Hide()
-        return
-    end
-    self:Hide()
-    DetachSubFrames(self:GetChildren())
-    self:SetAttribute("startingIndex", -1)
-    RegisterAttributeDriver(self, "state-visibility", "show")
-    self.dirtyWidth, self.dirtyHeight = self:GetSize()
-    RegisterAttributeDriver(self, "state-visibility", "[@raid1, exists] show;hide")
-    self:SetAttribute("startingIndex", 1)
-    self:SetAttribute("point", "BOTTOM")
-    self:SetAttribute("columnAnchorPoint", "LEFT")
-    DetachSubFrames(self:GetChildren())
-    self:SetAttribute("yOffset", 7)
-    if not self.positioned then
-        self:ClearAllPoints()
-        self:Point("TOPLEFT", SV.UIParent, "TOPLEFT", 4, -40)
-        SV.Mentalo:Add(self, L["Tank Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40")
-        self.Avatar.positionOverride = "TOPLEFT"
-        self:SetAttribute("minHeight", self.dirtyHeight)
-        self:SetAttribute("minWidth", self.dirtyWidth)
-        self.positioned = true
-    end
-    for i = 1, self:GetNumChildren() do
-        local childFrame = select(i, self:GetChildren())
-        UpdateTankSubUnit(childFrame, key, db)
-        if(_G[childFrame:GetName().."Pet"]) then
-            UpdateTankSubUnit(_G[childFrame:GetName().."Pet"], key, db)
-        end
-        if(_G[childFrame:GetName().."Target"]) then
-            UpdateTankSubUnit(_G[childFrame:GetName().."Target"], key, db)
-        end
-    end
-end
-
-CONSTRUCTORS["tank"] = function(self, unit)
-    local key = "tank"
-    local db = SV.db.SVUnit[key]
-    self.unit = unit
-    self.___key = key
-    self:SetScript("OnEnter", UnitFrame_OnEnter)
-    self:SetScript("OnLeave", UnitFrame_OnLeave)
-    MOD:SetActionPanel(self, key)
-    self.Health = MOD:CreateHealthBar(self, true)
-    self.RaidIcon = MOD:CreateRaidIcon(self)
-    self.RaidIcon:SetPoint("BOTTOMRIGHT")
-    self.Range = { insideAlpha = 1, outsideAlpha = 1 }
-    UpdateTankSubUnit(self, key, db)
-    self.originalParent = self:GetParent()
-    return self
-end
---[[
-##########################################################
-ASSIST
-##########################################################
-]]--
-local UpdateAssistSubUnit = function(self, key, db)
-    self.colors = oUF_Villain.colors;
-    self:RegisterForClicks(SV.db.SVUnit.fastClickTarget and "AnyDown" or "AnyUp")
-    MOD.RefreshUnitMedia(self, key)
-    if self.isChild and self.originalParent then
-        local targets = db.targetsGroup;
-        if not self.originalParent.childList then
-            self.originalParent.childList = {}
-        end
-        self.originalParent.childList[self] = true;
-        if not InCombatLockdown()then
-            if targets.enable then
-                local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(targets)
-                self:SetParent(self.originalParent)
-                self:Size(UNIT_WIDTH, UNIT_HEIGHT)
-                self:ClearAllPoints()
-                SV:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset)
-            else
-                self:SetParent(SV.Cloaked)
-            end
-        end
-    elseif not InCombatLockdown() then
-        local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db)
-        self:Size(UNIT_WIDTH, UNIT_HEIGHT)
-    end
-
-    MOD:RefreshUnitLayout(self, key)
-
-    do
-        local nametext = self.InfoPanel.Name;
-        if oUF_Villain.colors.healthclass then
-            self:Tag(nametext, "[name:10]")
-        else
-            self:Tag(nametext, "[name:color][name:10]")
-        end
-    end
-    self:UpdateAllElements()
-end
-
-local UpdateAssistFrame = function(self)
-    local key = "assist"
-    local db = SV.db.SVUnit[key]
-    self:Hide()
-    DetachSubFrames(self:GetChildren())
-    self:SetAttribute("startingIndex", -1)
-    RegisterAttributeDriver(self, "state-visibility", "show")
-    self.dirtyWidth, self.dirtyHeight = self:GetSize()
-    RegisterAttributeDriver(self, "state-visibility", "[@raid1, exists] show;hide")
-    self:SetAttribute("startingIndex", 1)
-    self:SetAttribute("point", "BOTTOM")
-    self:SetAttribute("columnAnchorPoint", "LEFT")
-    DetachSubFrames(self:GetChildren())
-    self:SetAttribute("yOffset", 7)
-    if not self.positioned then
-        self:ClearAllPoints()
-        self:Point("TOPLEFT", SV.UIParent, "TOPLEFT", 4, -140)
-        SV.Mentalo:Add(self, L["Assist Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40")
-        self.Avatar.positionOverride = "TOPLEFT"
-        self:SetAttribute("minHeight", self.dirtyHeight)
-        self:SetAttribute("minWidth", self.dirtyWidth)
-        self.positioned = true
-    end
-    for i = 1, self:GetNumChildren() do
-        local childFrame = select(i, self:GetChildren())
-        UpdateAssistSubUnit(childFrame, key, db)
-        if(_G[childFrame:GetName().."Pet"]) then
-            UpdateAssistSubUnit(_G[childFrame:GetName().."Pet"], key, db)
-        end
-        if(_G[childFrame:GetName().."Target"]) then
-            UpdateAssistSubUnit(_G[childFrame:GetName().."Target"], key, db)
-        end
-    end
-end
-
-CONSTRUCTORS["assist"] = function(self, unit)
-    local key = "assist"
-    local db = SV.db.SVUnit[key]
-    self.unit = unit
-    self.___key = key
-    self:SetScript("OnEnter", UnitFrame_OnEnter)
-    self:SetScript("OnLeave", UnitFrame_OnLeave)
-    MOD:SetActionPanel(self, key)
-    self.Health = MOD:CreateHealthBar(self, true)
-    self.RaidIcon = MOD:CreateRaidIcon(self)
-    self.RaidIcon:SetPoint("BOTTOMRIGHT")
-    self.Range = { insideAlpha = 1, outsideAlpha = 1 }
-    UpdateAssistSubUnit(self, key, db)
-    self.originalParent = self:GetParent()
-    return self
-end
---[[
-##########################################################
-GROUP HEADER METHODS
-##########################################################
-]]--
-local GroupSetConfigEnvironment = function(self)
-    local key = self.___groupkey
-    local db = SV.db.SVUnit[key]
-    local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db)
-    local anchorPoint;
-    local sorting = db.showBy
-    local pointMap = sortMapping[sorting]
-    local sortMethod = db.sortMethod
-    local widthCalc, heightCalc, xCalc, yCalc = 0, 0, 0, 0;
-    local point1, point2, point3, point4, point5, horizontal, vertical, isHorizontal = pointMap[1], pointMap[2], pointMap[3], pointMap[4], pointMap[5], pointMap[6], pointMap[7], pointMap[8];
-    for i = 1, db.groupCount do
-        local frame = self.groups[i]
-        if frame then
-            if(db.showBy == "UP") then
-                db.showBy = "UP_RIGHT"
-            end
-            if(db.showBy == "DOWN") then
-                db.showBy = "DOWN_RIGHT"
-            end
-            if isHorizontal then
-                frame:SetAttribute("xOffset", db.wrapXOffset * horizontal)
-                frame:SetAttribute("yOffset", 0)
-                frame:SetAttribute("columnSpacing", db.wrapYOffset)
-            else
-                frame:SetAttribute("xOffset", 0)
-                frame:SetAttribute("yOffset", db.wrapYOffset * vertical)
-                frame:SetAttribute("columnSpacing", db.wrapXOffset)
-            end
-            if not frame.isForced then
-                if not frame.initialized then
-                    frame:SetAttribute("startingIndex", db.customSorting and (-numMin(db.groupCount * db.gRowCol * 5, MAX_RAID_MEMBERS) + 1) or -4)
-                    frame:Show()
-                    frame.initialized = true
-                end
-                frame:SetAttribute("startingIndex", 1)
-            end
-            frame:ClearAllPoints()
-            if db.customSorting and db.invertGroupingOrder then
-                frame:SetAttribute("columnAnchorPoint", point4)
-            else
-                frame:SetAttribute("columnAnchorPoint", point3)
-            end
-            DetachSubFrames(frame:GetChildren())
-            frame:SetAttribute("point", point1)
-            if not frame.isForced then
-                frame:SetAttribute("maxColumns", db.customSorting and db.groupCount or 1)
-                frame:SetAttribute("unitsPerColumn", db.customSorting and (db.gRowCol * 5) or 5)
-                GroupDistributor[sortMethod](frame)
-                frame:SetAttribute("sortDir", db.sortDir)
-                frame:SetAttribute("showPlayer", db.showPlayer)
-            end
-            if i == 1 and db.customSorting then
-                frame:SetAttribute("groupFilter", "1, 2, 3, 4, 5, 6, 7, 8")
-            else
-                frame:SetAttribute("groupFilter", tostring(i))
-            end
-        end
-        local anchorPoint = point2
-        if db.customSorting and db.startFromCenter then
-            anchorPoint = point5
-        end
-        if (i - 1) % db.gRowCol == 0 then
-            if isHorizontal then
-                if frame then
-                    frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical)
-                end
-                heightCalc = heightCalc + UNIT_HEIGHT + db.wrapYOffset;
-                yCalc = yCalc + 1
-            else
-                if frame then
-                    frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0)
-                end
-                widthCalc = widthCalc + UNIT_WIDTH + db.wrapXOffset;
-                xCalc = xCalc + 1
-            end
-        else
-            if isHorizontal then
-                if yCalc == 1 then
-                    if frame then
-                        frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0)
-                    end
-                    widthCalc = widthCalc + (UNIT_WIDTH + db.wrapXOffset) * 5;
-                    xCalc = xCalc + 1
-                elseif frame then
-                    frame:SetPoint(anchorPoint, self, anchorPoint, (((UNIT_WIDTH + db.wrapXOffset) * 5) * ((i - 1) % db.gRowCol)) * horizontal, ((UNIT_HEIGHT + db.wrapYOffset) * (yCalc - 1)) * vertical)
-                end
-            else
-                if xCalc == 1 then
-                    if frame then
-                        frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical)
-                    end
-                    heightCalc = heightCalc + (UNIT_HEIGHT + db.wrapYOffset) * 5;
-                    yCalc = yCalc + 1
-                elseif frame then
-                    frame:SetPoint(anchorPoint, self, anchorPoint, ((UNIT_WIDTH + db.wrapXOffset) * (xCalc - 1)) * horizontal, (((UNIT_HEIGHT + db.wrapYOffset) * 5) * ((i - 1) % db.gRowCol)) * vertical)
-                end
-            end
-        end
-        if heightCalc == 0 then
-            heightCalc = heightCalc + (UNIT_HEIGHT + db.wrapYOffset) * 5
-        elseif widthCalc == 0 then
-            widthCalc = widthCalc + (UNIT_WIDTH + db.wrapXOffset) * 5
-        end
-    end
-    self:SetSize(widthCalc - db.wrapXOffset, heightCalc - db.wrapYOffset)
-end
-
-local GroupHeaderUpdate = function(self)
-    local key = self.___groupkey
-    if SV.db.SVUnit[key].enable ~= true then
-        UnregisterAttributeDriver(self, "state-visibility")
-        self:Hide()
-        return
-    end
-    for i=1,#self.groups do
-        self.groups[i]:Update()
-    end
-end
-
-local GroupHeaderMediaUpdate = function(self)
-    for i=1,#self.groups do
-        self.groups[i]:MediaUpdate()
-    end
-end
-
-local GroupSetActiveState = function(self)
-    if not self.isForced then
-        local key = self.___groupkey
-        local db = SV.db.SVUnit[key]
-        if(db) then
-            for i=1,#self.groups do
-                local frame = self.groups[i]
-                if(i <= db.groupCount and ((db.customSorting and i <= 1) or not db.customSorting)) then
-
-                    frame:Show()
-                else
-                    if frame.forceShow then
-                        frame:Hide()
-                        MOD:RestrictChildren(frame, frame:GetChildren())
-                        frame:SetAttribute('startingIndex',1)
-                    else
-                        frame:ClearAllAttributes()
-                    end
-                end
-            end
-        end
-    end
-end
---[[
-##########################################################
-SUBUNIT CONSTRUCTORS
-##########################################################
-]]--
-local SecureHeaderClear = function(self)
-    self:Hide()
-    self:SetAttribute("showPlayer", true)
-    self:SetAttribute("showSolo", true)
-    self:SetAttribute("showParty", true)
-    self:SetAttribute("showRaid", true)
-    self:SetAttribute("columnSpacing", nil)
-    self:SetAttribute("columnAnchorPoint", nil)
-    self:SetAttribute("sortMethod", nil)
-    self:SetAttribute("groupFilter", nil)
-    self:SetAttribute("groupingOrder", nil)
-    self:SetAttribute("maxColumns", nil)
-    self:SetAttribute("nameList", nil)
-    self:SetAttribute("point", nil)
-    self:SetAttribute("sortDir", nil)
-    self:SetAttribute("sortMethod", "NAME")
-    self:SetAttribute("startingIndex", nil)
-    self:SetAttribute("strictFiltering", nil)
-    self:SetAttribute("unitsPerColumn", nil)
-    self:SetAttribute("xOffset", nil)
-    self:SetAttribute("yOffset", nil)
-end
-
-function MOD:ConstructGroupHeader(parentFrame, filter, styleName, headerName, template1, groupName, template2, updateFunc)
-    local db = SV.db.SVUnit[groupName]
-    local UNIT_WIDTH, UNIT_HEIGHT = self:GetActiveSize(db)
-
-    oUF_Villain:SetActiveStyle(styleName)
-    local groupHeader = oUF_Villain:SpawnHeader(headerName, template2, nil,
-        "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d); self:SetFrameLevel(5)"):format(UNIT_WIDTH, UNIT_HEIGHT),
-        "groupFilter", filter,
-        "showParty", true,
-        "showRaid", true,
-        "showSolo", true,
-        template1 and "template", template1
-    )
-    groupHeader.___groupkey = groupName
-    groupHeader:SetParent(parentFrame)
-    groupHeader:Show()
-
-    groupHeader.Update = updateFunc or GROUP_UPDATES[groupName]
-    groupHeader.MediaUpdate = GroupMediaUpdate
-    groupHeader.ClearAllAttributes = SecureHeaderClear
-
-    return groupHeader
-end
---[[
-##########################################################
-LOAD/UPDATE METHOD
-##########################################################
-]]--
-function MOD:SetGroupFrame(key, filter, template1, forceUpdate, template2)
-    if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end
-    if(not SV.db.SVUnit.enable or not SV.db.SVUnit[key]) then return end
-    local db = SV.db.SVUnit[key]
-    local realName = key:gsub("(.)", upper, 1)
-    local styleName = "SVUI_"..realName
-    local frame, groupName
-
-    if(not self.Headers[key]) then
-        oUF_Villain:RegisterStyle(styleName, CONSTRUCTORS[key])
-        oUF_Villain:SetActiveStyle(styleName)
-
-        if(key == "tank") then
-            frame = self:ConstructGroupHeader(SVUI_UnitFrameParent, filter, styleName, styleName, template1, key, template2, UpdateTankFrame)
-        elseif(key == "assist") then
-            frame = self:ConstructGroupHeader(SVUI_UnitFrameParent, filter, styleName, styleName, template1, key, template2, UpdateAssistFrame)
-        else
-            frame = CreateFrame("Frame", styleName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate")
-            frame.groups = {}
-            frame.___groupkey = key;
-            frame.Update = GroupHeaderUpdate
-            frame.MediaUpdate = GroupHeaderMediaUpdate
-            frame.SetActiveState = GroupSetActiveState
-            frame.SetConfigEnvironment = GroupSetConfigEnvironment
-        end
-        frame:Show()
-        self.Headers[key] = frame
-    else
-        frame = self.Headers[key]
-    end
-
-    if(key == "tank" or key == "assist") then
-        frame:Update()
-    else
-        if(db.enable ~= true and key ~= "raidpet") then
-            UnregisterStateDriver(frame, "visibility")
-            frame:Hide()
-            return
-        end
-
-        if(db.customSorting) then
-            if(not frame.groups[1]) then
-                groupName = styleName .. "Group1"
-                local subunit = self:ConstructGroupHeader(frame, 1, styleName, groupName, template1, key, template2)
-                frame.groups[1] = subunit
-            end
-        else
-            for i = 1, db.groupCount do
-                if(not frame.groups[i]) then
-                    groupName = styleName .. "Group" .. i
-                    local subunit = self:ConstructGroupHeader(frame, i, styleName, groupName, template1, key, template2)
-                    frame.groups[i] = subunit
-                end
-            end
-        end
-
-        frame:SetActiveState()
-
-        if(forceUpdate or not frame.Avatar) then
-            frame:SetConfigEnvironment()
-            if(not frame.isForced) then
-                RegisterStateDriver(frame, "visibility", db.visibility)
-            end
-        else
-            frame:SetConfigEnvironment()
-            frame:Update()
-        end
-
-        if(db.enable ~= true and key == "raidpet") then
-            UnregisterStateDriver(frame, "visibility")
-            frame:Hide()
-            return
-        end
-    end
 end
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI/packages/unit/groups.lua b/Interface/AddOns/SVUI/packages/unit/groups.lua
new file mode 100644
index 0000000..eb39ac0
--- /dev/null
+++ b/Interface/AddOns/SVUI/packages/unit/groups.lua
@@ -0,0 +1,1324 @@
+--[[
+##############################################################################
+_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_       #
+ ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__      #
+  __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____     #
+   ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____    #
+    ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____   #
+     _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____  #
+      __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ #
+       _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_#
+        ___\///////////___________\///___________\/////////_____\///////////_#
+##############################################################################
+S U P E R - V I L L A I N - U I   By: Munglunch                              #
+##############################################################################
+--]]
+--LUA
+local unpack        = unpack;
+local select        = select;
+local pairs         = pairs;
+local type          = type;
+local rawset        = rawset;
+local rawget        = rawget;
+local tostring      = tostring;
+local error         = error;
+local next          = next;
+local pcall         = pcall;
+local getmetatable  = getmetatable;
+local setmetatable  = setmetatable;
+local assert        = assert;
+--BLIZZARD
+local _G            = _G;
+local tinsert       = _G.tinsert;
+local tremove       = _G.tremove;
+local twipe         = _G.wipe;
+--STRING
+local string        = string;
+local format        = string.format;
+local sub           = string.sub;
+local upper         = string.upper;
+local match         = string.match;
+local gsub          = string.gsub;
+--MATH
+local math          = math;
+local numMin        = math.min;
+--TABLE
+local table         = table;
+local tsort         = table.sort;
+local tremove       = table.remove;
+
+local SV = select(2, ...)
+local oUF_Villain = SV.oUF
+
+assert(oUF_Villain, "SVUI was unable to locate oUF.")
+
+local L = SV.L;
+local MOD = SV.SVUnit
+
+if(not MOD) then return end
+--[[
+##########################################################
+LOCAL DATA
+##########################################################
+]]--
+local sortMapping = {
+    ["DOWN_RIGHT"] = {[1]="TOP",[2]="TOPLEFT",[3]="LEFT",[4]=1,[5]=-1,[6]=false},
+    ["DOWN_LEFT"] = {[1]="TOP",[2]="TOPRIGHT",[3]="RIGHT",[4]=1,[5]=-1,[6]=false},
+    ["UP_RIGHT"] = {[1]="BOTTOM",[2]="BOTTOMLEFT",[3]="LEFT",[4]=1,[5]=1,[6]=false},
+    ["UP_LEFT"] = {[1]="BOTTOM",[2]="BOTTOMRIGHT",[3]="RIGHT",[4]=-1,[5]=1,[6]=false},
+    ["RIGHT_DOWN"] = {[1]="LEFT",[2]="TOPLEFT",[3]="TOP",[4]=1,[5]=-1,[6]=true},
+    ["RIGHT_UP"] = {[1]="LEFT",[2]="BOTTOMLEFT",[3]="BOTTOM",[4]=1,[5]=1,[6]=true},
+    ["LEFT_DOWN"] = {[1]="RIGHT",[2]="TOPRIGHT",[3]="TOP",[4]=-1,[5]=-1,[6]=true},
+    ["LEFT_UP"] = {[1]="RIGHT",[2]="BOTTOMRIGHT",[3]="BOTTOM",[4]=-1,[5]=1,[6]=true},
+    ["UP"] = {[1]="BOTTOM",[2]="BOTTOM",[3]="BOTTOM",[4]=1,[5]=1,[6]=false},
+    ["DOWN"] = {[1]="TOP",[2]="TOP",[3]="TOP",[4]=1,[5]=1,[6]=false},
+}
+local GroupDistributor = {
+    ["CLASS"] = function(x)
+        x:SetAttribute("groupingOrder","DEATHKNIGHT,DRUID,HUNTER,MAGE,PALADIN,PRIEST,SHAMAN,WARLOCK,WARRIOR,MONK")
+        x:SetAttribute("sortMethod","NAME")
+        x:SetAttribute("groupBy","CLASS")
+    end,
+    ["MTMA"] = function(x)
+        x:SetAttribute("groupingOrder","MAINTANK,MAINASSIST,NONE")
+        x:SetAttribute("sortMethod","NAME")
+        x:SetAttribute("groupBy","ROLE")
+    end,
+    ["ROLE_TDH"] = function(x)
+        x:SetAttribute("groupingOrder","TANK,DAMAGER,HEALER,NONE")
+        x:SetAttribute("sortMethod","NAME")
+        x:SetAttribute("groupBy","ASSIGNEDROLE")
+    end,
+    ["ROLE_HTD"] = function(x)
+        x:SetAttribute("groupingOrder","HEALER,TANK,DAMAGER,NONE")
+        x:SetAttribute("sortMethod","NAME")
+        x:SetAttribute("groupBy","ASSIGNEDROLE")
+    end,
+    ["ROLE_HDT"] = function(x)
+        x:SetAttribute("groupingOrder","HEALER,DAMAGER,TANK,NONE")
+        x:SetAttribute("sortMethod","NAME")
+        x:SetAttribute("groupBy","ASSIGNEDROLE")
+    end,
+    ["ROLE"] = function(x)
+        x:SetAttribute("groupingOrder","TANK,HEALER,DAMAGER,NONE")
+        x:SetAttribute("sortMethod","NAME")
+        x:SetAttribute("groupBy","ASSIGNEDROLE")
+    end,
+    ["NAME"] = function(x)
+        x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8")
+        x:SetAttribute("sortMethod","NAME")
+        x:SetAttribute("groupBy",nil)
+    end,
+    ["GROUP"] = function(x)
+        x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8")
+        x:SetAttribute("sortMethod","INDEX")
+        x:SetAttribute("groupBy","GROUP")
+    end,
+    ["PETNAME"] = function(x)
+        x:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8")
+        x:SetAttribute("sortMethod","NAME")
+        x:SetAttribute("groupBy", nil)
+        x:SetAttribute("filterOnPet", true)
+    end
+}
+--[[
+##########################################################
+FRAME HELPERS
+##########################################################
+]]--
+local function RaidLayoutEnabled(token)
+    local maxPlayers = select(5, GetInstanceInfo())
+    if(token == "raid10" and (maxPlayers == 10)) then
+        return true;
+    elseif(token == "raid25" and ((maxPlayers > 10) and (maxPlayers < 40))) then
+        return true;
+    elseif(token == "raid40" and (maxPlayers > 25)) then
+        return true;
+    end
+    return false;
+end
+
+local DetachSubFrames = function(...)
+    for i = 1, select("#", ...) do
+        local frame = select(i,...)
+        frame:ClearAllPoints()
+    end
+end
+
+local UpdateTargetGlow = function(self)
+    if not self.unit then return end
+    local unit = self.unit;
+    if(UnitIsUnit(unit, "target")) then
+        self.TargetGlow:Show()
+        local reaction = UnitReaction(unit, "player")
+        if(UnitIsPlayer(unit)) then
+            local _, class = UnitClass(unit)
+            if class then
+                local colors = RAID_CLASS_COLORS[class]
+                self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b)
+            else
+                self.TargetGlow:SetBackdropBorderColor(1, 1, 1)
+            end
+        elseif(reaction) then
+            local colors = FACTION_BAR_COLORS[reaction]
+            self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b)
+        else
+            self.TargetGlow:SetBackdropBorderColor(1, 1, 1)
+        end
+    else
+        self.TargetGlow:Hide()
+    end
+end
+--[[
+##########################################################
+TEMPLATES AND PROTOTYPES
+##########################################################
+]]--
+local BuildTemplates = {};
+local UpdateTemplates = {};
+--[[
+##########################################################
+COMMON
+##########################################################
+]]--
+local AllowElement = function(self)
+    if InCombatLockdown() then return; end
+
+    if not self.isForced then
+        self.sourceElement = self.unit;
+        self.unit = "player"
+        self.isForced = true;
+        self.sourceEvent = self:GetScript("OnUpdate")
+    end
+
+    self:SetScript("OnUpdate", nil)
+    self.forceShowAuras = true;
+
+    UnregisterUnitWatch(self)
+    RegisterUnitWatch(self, true)
+
+    self:Show()
+    if self:IsVisible() and self.Update then
+        self:Update()
+    end
+end
+
+local RestrictElement = function(self)
+    if(InCombatLockdown() or (not self.isForced)) then return; end
+
+    self.forceShowAuras = nil
+    self.isForced = nil
+
+    UnregisterUnitWatch(self)
+    RegisterUnitWatch(self)
+
+    if self.sourceEvent then
+        self:SetScript("OnUpdate", self.sourceEvent)
+        self.sourceEvent = nil
+    end
+
+    self.unit = self.sourceElement or self.unit;
+
+    if self:IsVisible() and self.Update then
+        self:Update()
+    end
+end
+--[[
+##########################################################
+PARTY FRAMES
+##########################################################
+]]--
+local PartyVisibility = function(self, event)
+    local db = SV.db.SVUnit.party
+    if(not SV.db.SVUnit or (not SV.db.SVUnit.party)) then return end
+    if ((not SV.db.SVUnit.party.enable) or self.isForced) then return end
+
+    if(event == "PLAYER_REGEN_ENABLED") then
+        self:UnregisterEvent("PLAYER_REGEN_ENABLED")
+    end
+
+    if(not InCombatLockdown()) then
+        local instance, instanceType = IsInInstance()
+        if(instance and instanceType == "raid") then
+            UnregisterStateDriver(self,"visibility")
+            self:Hide()
+        elseif(db.visibility) then
+            RegisterStateDriver(self, "visibility", db.visibility)
+        end
+    else
+        self:RegisterEvent("PLAYER_REGEN_ENABLED")
+    end
+end
+
+UpdateTemplates["party"] = function(self)
+    local token = self.___groupkey
+    local db = SV.db.SVUnit[token]
+    local groupFrame = self:GetParent()
+
+    if not groupFrame.positioned then
+        groupFrame:ClearAllPoints()
+        groupFrame:Point("LEFT",SV.UIParent,"LEFT",40,0)
+        SV.Mentalo:Add(groupFrame, L['Party Frames'], nil, nil, nil, 'ALL,PARTY,ARENA');
+        groupFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
+        groupFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
+        groupFrame:SetScript("OnEvent", PartyVisibility)
+        groupFrame.positioned = true;
+    end
+
+    PartyVisibility(groupFrame)
+
+    local index = 1;
+    local attIndex = ("child%d"):format(index)
+    local childFrame = self:GetAttribute(attIndex)
+    local childName = childFrame:GetName()
+    local petFrame = _G[("%sPet"):format(childName)]
+    local targetFrame = _G[("%sTarget"):format(childName)]
+
+    while childFrame do
+        childFrame:UnitUpdate()
+
+        childName = childFrame:GetName()
+        petFrame = _G[("%sPet"):format(childName)]
+        targetFrame = _G[("%sTarget"):format(childName)]
+
+        if(petFrame) then
+            petFrame:UnitUpdate()
+        end
+
+        if(targetFrame) then
+            targetFrame:UnitUpdate()
+        end
+
+        index = index + 1;
+        attIndex = ("child%d"):format(index)
+        childFrame = self:GetAttribute(attIndex)
+    end
+end
+
+local PartyUnitUpdate = function(self)
+    local token = self.___key
+    local db = SV.db.SVUnit["party"]
+    self.colors = oUF_Villain.colors;
+    self:RegisterForClicks(SV.db.SVUnit.fastClickTarget and 'AnyDown' or 'AnyUp')
+    MOD.RefreshUnitMedia(self, token)
+    if self.isChild then
+        local altDB = db.petsGroup;
+        if self == _G[self.originalParent:GetName()..'Target'] then
+            altDB = db.targetsGroup
+        end
+        if not self.originalParent.childList then
+            self.originalParent.childList = {}
+        end
+        self.originalParent.childList[self] = true;
+        if not InCombatLockdown()then
+            if altDB.enable then
+                local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(altDB, "partychild")
+                self:SetParent(self.originalParent)
+                self:Size(UNIT_WIDTH, UNIT_HEIGHT)
+                self:ClearAllPoints()
+                SV:ReversePoint(self, altDB.anchorPoint, self.originalParent, altDB.xOffset, altDB.yOffset)
+            else
+                self:SetParent(SV.Cloaked)
+            end
+        end
+        do
+            local health = self.Health;
+            health.Smooth = nil;
+            health.frequentUpdates = nil;
+            health.colorSmooth = nil;
+            health.colorHealth = nil;
+            health.colorClass = true;
+            health.colorReaction = true;
+            health:ClearAllPoints()
+            health:Point("TOPRIGHT", self, "TOPRIGHT", -1, -1)
+            health:Point("BOTTOMLEFT", self, "BOTTOMLEFT", 1, 1)
+        end
+        do
+            local nametext = self.InfoPanel.Name
+            self:Tag(nametext, altDB.tags)
+        end
+    else
+        if not InCombatLockdown() then
+            local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db, "party")
+            self:Size(UNIT_WIDTH, UNIT_HEIGHT)
+        end
+        MOD:RefreshUnitLayout(self, token)
+        MOD:UpdateAuraWatch(self, token)
+    end
+    self:EnableElement('ReadyCheck')
+    self:UpdateAllElements()
+end
+
+BuildTemplates["party"] = function(self, unit)
+    local token = "party"
+    self.unit = unit
+    self.___key = token
+    self:SetScript("OnEnter", UnitFrame_OnEnter)
+    self:SetScript("OnLeave", UnitFrame_OnLeave)
+
+    MOD:SetActionPanel(self, token)
+    self.Health = MOD:CreateHealthBar(self, true)
+
+    if self.isChild then
+        self.originalParent = self:GetParent()
+    else
+        self.Power = MOD:CreatePowerBar(self, true)
+        self.Power.frequentUpdates = false
+        MOD:CreatePortrait(self, true)
+        self.Buffs = MOD:CreateBuffs(self, token)
+        self.Debuffs = MOD:CreateDebuffs(self, token)
+        self.AuraWatch = MOD:CreateAuraWatch(self, token)
+        self.Afflicted = MOD:CreateAfflicted(self)
+        self.ResurrectIcon = MOD:CreateResurectionIcon(self)
+        self.LFDRole = MOD:CreateRoleIcon(self)
+        self.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(self)
+        self.RaidIcon = MOD:CreateRaidIcon(self)
+        self.ReadyCheck = MOD:CreateReadyCheckIcon(self)
+        self.HealPrediction = MOD:CreateHealPrediction(self)
+        --self.GPS = MOD:CreateGPS(self, true)
+
+        local shadow = CreateFrame("Frame", nil, self)
+        shadow:SetFrameLevel(1)
+        shadow:SetFrameStrata(self:GetFrameStrata())
+        shadow:WrapOuter(self, 3, 3)
+        shadow:SetBackdrop({
+            edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]],
+            edgeSize = 3,
+            insets = {
+                left = 5,
+                right = 5,
+                top = 5,
+                bottom = 5
+            }
+        })
+        shadow:SetBackdropColor(0, 0, 0, 0)
+        shadow:SetBackdropBorderColor(0, 0, 0, 0.9)
+        shadow:Hide()
+        self.TargetGlow = shadow
+        tinsert(self.__elements, UpdateTargetGlow)
+        self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow)
+        self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow)
+        self:RegisterEvent("GROUP_ROSTER_UPDATE", UpdateTargetGlow)
+    end
+
+    self.Range = { insideAlpha = 1, outsideAlpha = 1 }
+
+    self.Restrict = RestrictElement
+    self.Allow = AllowElement
+    self.UnitUpdate = PartyUnitUpdate
+
+    return self
+end
+--[[
+##########################################################
+RAID FRAMES
+##########################################################
+]]--
+local RaidVisibility = {
+    ["raid10"] = function(self, event)
+        local db = SV.db.SVUnit.raid10
+        if(not db or (not db.enable) or self.isForced) then return end
+
+        if(event and event == "PLAYER_REGEN_ENABLED") then
+            self:UnregisterEvent("PLAYER_REGEN_ENABLED")
+        end
+
+        if not InCombatLockdown() then
+            local instance, instanceType = IsInInstance()
+            if(instance and (instanceType == "raid")) then
+                UnregisterStateDriver(self, "visibility")
+                local maxPlayers = select(5, GetInstanceInfo())
+                if(maxPlayers == 10) then
+                    self:Show()
+                else
+                    self:Hide()
+                end
+            elseif(db.visibility) then
+                RegisterStateDriver(self, "visibility", db.visibility)
+            end
+        else
+            self:RegisterEvent("PLAYER_REGEN_ENABLED")
+            return
+        end
+    end,
+    ["raid25"] = function(self, event)
+        local db = SV.db.SVUnit.raid25
+        if(not db or (not db.enable) or self.isForced) then return end
+
+        if(event and event == "PLAYER_REGEN_ENABLED") then
+            self:UnregisterEvent("PLAYER_REGEN_ENABLED")
+        end
+
+        if not InCombatLockdown() then
+            local instance, instanceType = IsInInstance()
+            if(instance and (instanceType == "raid")) then
+                UnregisterStateDriver(self, "visibility")
+                local maxPlayers = select(5, GetInstanceInfo())
+                if((maxPlayers > 10) and (maxPlayers < 40)) then
+                    self:Show()
+                else
+                    self:Hide()
+                end
+            elseif(db.visibility) then
+                RegisterStateDriver(self, "visibility", db.visibility)
+            end
+        else
+            self:RegisterEvent("PLAYER_REGEN_ENABLED")
+            return
+        end
+    end,
+    ["raid40"] = function(self, event)
+        local db = SV.db.SVUnit.raid40
+        if(not db or (not db.enable) or self.isForced) then return end
+
+        if(event and event == "PLAYER_REGEN_ENABLED") then
+            self:UnregisterEvent("PLAYER_REGEN_ENABLED")
+        end
+
+        if not InCombatLockdown() then
+            local instance, instanceType = IsInInstance()
+            if(instance and (instanceType == "raid")) then
+                UnregisterStateDriver(self, "visibility")
+                local maxPlayers = select(5, GetInstanceInfo())
+                if(maxPlayers > 25) then
+                    self:Show()
+                else
+                    self:Hide()
+                end
+            elseif(db.visibility) then
+                RegisterStateDriver(self, "visibility", db.visibility)
+            end
+        else
+            self:RegisterEvent("PLAYER_REGEN_ENABLED")
+            return
+        end
+    end,
+}
+
+local RaidUpdatePrototype = function(token)
+    return function(self)
+        local db = SV.db.SVUnit[token]
+        local groupFrame = self:GetParent()
+
+        if not groupFrame.positioned then
+            groupFrame:ClearAllPoints()
+            groupFrame:Point("LEFT", SV.UIParent, "LEFT", 4, 0)
+            SV.Mentalo:Add(groupFrame, L["Raid Frames"])
+            groupFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
+            groupFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
+            groupFrame:SetScript("OnEvent", RaidVisibility[token])
+            groupFrame.positioned = true
+        end
+
+        RaidVisibility[token](groupFrame)
+
+        local index = 1;
+        local attIndex = ("child%d"):format(index)
+        local childFrame = self:GetAttribute(attIndex)
+        local childName = childFrame:GetName()
+        local petFrame = _G[("%sPet"):format(childName)]
+        local targetFrame = _G[("%sTarget"):format(childName)]
+
+        while childFrame do
+            childFrame:UnitUpdate()
+
+            childName = childFrame:GetName()
+            petFrame = _G[("%sPet"):format(childName)]
+            targetFrame = _G[("%sTarget"):format(childName)]
+
+            if(petFrame) then
+                petFrame:UnitUpdate()
+            end
+
+            if(targetFrame) then
+                targetFrame:UnitUpdate()
+            end
+
+            index = index + 1;
+            attIndex = ("child%d"):format(index)
+            childFrame = self:GetAttribute(attIndex)
+        end
+    end
+end
+
+local RaidUnitUpdate = function(self)
+    local token = self.___key
+    local db = SV.db.SVUnit[token]
+    self.colors = oUF_Villain.colors;
+    self:RegisterForClicks(SV.db.SVUnit.fastClickTarget and "AnyDown" or "AnyUp")
+
+    local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db)
+    if not InCombatLockdown() then
+        self:Size(UNIT_WIDTH, UNIT_HEIGHT)
+    end
+
+    do
+        local rdBuffs = self.RaidDebuffs;
+        if db.rdebuffs.enable then
+            if not self:IsElementEnabled('RaidDebuffs') then
+                self:EnableElement("RaidDebuffs")
+            end
+            local actualSz = numMin(db.rdebuffs.size, (UNIT_HEIGHT - 8))
+            rdBuffs:Size(actualSz)
+            rdBuffs:Point("CENTER", self, "CENTER", db.rdebuffs.xOffset, db.rdebuffs.yOffset)
+            rdBuffs:Show()
+        else
+            self:DisableElement("RaidDebuffs")
+            rdBuffs:Hide()
+        end
+    end
+
+    MOD.RefreshUnitMedia(self, token)
+    MOD:UpdateAuraWatch(self, token)
+    MOD:RefreshUnitLayout(self, token)
+
+    if(token ~= "raidpet") then
+        self:EnableElement("ReadyCheck")
+    end
+    self:UpdateAllElements()
+end
+
+local RaidBuildPrototype = function(token)
+    return function(self, unit)
+        self.unit = unit
+        self.___key = token
+        MOD:SetActionPanel(self, token)
+        self.Health = MOD:CreateHealthBar(self, true)
+        self.Health.frequentUpdates = false
+        self.Power = MOD:CreatePowerBar(self, true)
+        self.Power.frequentUpdates = false
+        self.Buffs = MOD:CreateBuffs(self, token)
+        self.Debuffs = MOD:CreateDebuffs(self, token)
+        self.AuraWatch = MOD:CreateAuraWatch(self, token)
+        self.RaidDebuffs = MOD:CreateRaidDebuffs(self)
+        self.Afflicted = MOD:CreateAfflicted(self)
+        self.ResurrectIcon = MOD:CreateResurectionIcon(self)
+        self.LFDRole = MOD:CreateRoleIcon(self)
+        self.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(self)
+        self.RaidIcon = MOD:CreateRaidIcon(self)
+        self.ReadyCheck = MOD:CreateReadyCheckIcon(self)
+        self.HealPrediction = MOD:CreateHealPrediction(self)
+        self.Range = { insideAlpha = 1, outsideAlpha = 1 }
+
+        self.Restrict = RestrictElement
+        self.Allow = AllowElement
+        self.UnitUpdate = RaidUnitUpdate
+
+        local shadow = CreateFrame("Frame", nil, self)
+        shadow:SetFrameLevel(1)
+        shadow:SetFrameStrata(self:GetFrameStrata())
+        shadow:WrapOuter(self, 3, 3)
+        shadow:SetBackdrop({
+            edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]],
+            edgeSize = 3,
+            insets = {
+                left = 5,
+                right = 5,
+                top = 5,
+                bottom = 5
+            }
+        })
+        shadow:SetBackdropColor(0, 0, 0, 0)
+        shadow:SetBackdropBorderColor(0, 0, 0, 0.9)
+        shadow:Hide()
+        self.TargetGlow = shadow
+
+        tinsert(self.__elements, UpdateTargetGlow)
+
+        self:SetScript("OnEnter", UnitFrame_OnEnter)
+        self:SetScript("OnLeave", UnitFrame_OnLeave)
+        self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow)
+        self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow)
+
+        return self
+    end
+end
+
+UpdateTemplates["raid10"] = RaidUpdatePrototype("raid10")
+UpdateTemplates["raid25"] = RaidUpdatePrototype("raid25")
+UpdateTemplates["raid40"] = RaidUpdatePrototype("raid40")
+
+BuildTemplates["raid10"] = RaidBuildPrototype("raid10")
+BuildTemplates["raid25"] = RaidBuildPrototype("raid25")
+BuildTemplates["raid40"] = RaidBuildPrototype("raid40")
+--[[
+##########################################################
+RAID PETS
+##########################################################
+]]--
+local RaidPetVisibility = function(self, event)
+    local db = SV.db.SVUnit["raidpet"]
+    if (not db or (db and not db.enable) or self.isForced) then return end
+    local inInstance, instanceType = IsInInstance()
+    if event == "PLAYER_REGEN_ENABLED" then self:UnregisterEvent("PLAYER_REGEN_ENABLED") end
+
+    if not InCombatLockdown() then
+        if inInstance and instanceType == "raid" then
+            UnregisterStateDriver(self, "visibility")
+            self:Show()
+        else
+            RegisterStateDriver(self, "visibility", "[group:raid] show; hide")
+        end
+    else
+        self:RegisterEvent("PLAYER_REGEN_ENABLED")
+        return
+    end
+end
+
+UpdateTemplates["raidpet"] = function(self)
+    local token = self.___key
+    local db = SV.db.SVUnit[token]
+    local groupFrame = self:GetParent()
+
+    if not groupFrame.positioned then
+        groupFrame:ClearAllPoints()
+        groupFrame:Point("BOTTOMLEFT", SV.UIParent, "BOTTOMLEFT", 4, 433)
+        SV.Mentalo:Add(groupFrame, L["Raid Pet Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40")
+        groupFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
+        groupFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
+        groupFrame:SetScript("OnEvent", RaidPetVisibility)
+        groupFrame.positioned = true;
+    end
+
+    RaidPetVisibility(groupFrame)
+
+    local index = 1;
+    local attIndex = ("child%d"):format(index)
+    local childFrame = self:GetAttribute(attIndex)
+    local childName = childFrame:GetName()
+    local petFrame = _G[("%sPet"):format(childName)]
+    local targetFrame = _G[("%sTarget"):format(childName)]
+
+    while childFrame do
+        childFrame:UnitUpdate()
+
+        childName = childFrame:GetName()
+        petFrame = _G[("%sPet"):format(childName)]
+        targetFrame = _G[("%sTarget"):format(childName)]
+
+        if(petFrame) then
+            petFrame:UnitUpdate()
+        end
+
+        if(targetFrame) then
+            targetFrame:UnitUpdate()
+        end
+
+        index = index + 1;
+        attIndex = ("child%d"):format(index)
+        childFrame = self:GetAttribute(attIndex)
+    end
+end
+
+BuildTemplates["raidpet"] = function(self, unit)
+    local key = "raidpet"
+    self.unit = unit
+    self.___key = key
+    self:SetScript("OnEnter", UnitFrame_OnEnter)
+    self:SetScript("OnLeave", UnitFrame_OnLeave)
+    MOD:SetActionPanel(self, key)
+    self.Health = MOD:CreateHealthBar(self, true)
+    self.Debuffs = MOD:CreateDebuffs(self, key)
+    self.AuraWatch = MOD:CreateAuraWatch(self, key)
+    self.RaidDebuffs = MOD:CreateRaidDebuffs(self)
+    self.Afflicted = MOD:CreateAfflicted(self)
+    self.RaidIcon = MOD:CreateRaidIcon(self)
+    self.Range = { insideAlpha = 1, outsideAlpha = 1 }
+
+    self.Restrict = RestrictElement
+    self.Allow = AllowElement
+    self.UnitUpdate = RaidUnitUpdate
+
+    local shadow = CreateFrame("Frame", nil, self)
+    shadow:SetFrameLevel(1)
+    shadow:SetFrameStrata(self:GetFrameStrata())
+    shadow:WrapOuter(self, 3, 3)
+    shadow:SetBackdrop({
+        edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]],
+        edgeSize = 3,
+        insets = {
+            left = 5,
+            right = 5,
+            top = 5,
+            bottom = 5
+        }
+    })
+    shadow:SetBackdropColor(0, 0, 0, 0)
+    shadow:SetBackdropBorderColor(0, 0, 0, 0.9)
+    shadow:Hide()
+    self.TargetGlow = shadow
+    tinsert(self.__elements, UpdateTargetGlow)
+
+    self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow)
+    self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow)
+    return self
+end
+--[[
+##########################################################
+TANK
+##########################################################
+]]--
+local TankUnitUpdate = function(self)
+    local token = "tank"
+    local db = SV.db.SVUnit[token]
+    self.colors = oUF_Villain.colors;
+    self:RegisterForClicks(SV.db.SVUnit.fastClickTarget and "AnyDown" or "AnyUp")
+    MOD.RefreshUnitMedia(self, token)
+    if self.isChild and self.originalParent then
+        local targets = db.targetsGroup;
+        if not self.originalParent.childList then
+            self.originalParent.childList = {}
+        end
+        self.originalParent.childList[self] = true;
+        if not InCombatLockdown()then
+            if targets.enable then
+                local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(targets)
+                self:SetParent(self.originalParent)
+                self:Size(UNIT_WIDTH, UNIT_HEIGHT)
+                self:ClearAllPoints()
+                SV:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset)
+            else
+                self:SetParent(SV.Cloaked)
+            end
+        end
+    elseif not InCombatLockdown() then
+        local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db)
+        self:Size(UNIT_WIDTH, UNIT_HEIGHT)
+    end
+    MOD:RefreshUnitLayout(self, token)
+    do
+        local nametext = self.InfoPanel.Name;
+        if oUF_Villain.colors.healthclass then
+            self:Tag(nametext, "[name:10]")
+        else
+            self:Tag(nametext, "[name:color][name:10]")
+        end
+    end
+    self:UpdateAllElements()
+end
+
+UpdateTemplates["tank"] = function(self)
+    local token = "tank"
+    local db = SV.db.SVUnit[token]
+
+    if db.enable ~= true then
+        UnregisterAttributeDriver(self, "state-visibility")
+        self:Hide()
+        return
+    end
+
+    self:Hide()
+    DetachSubFrames(self:GetChildren())
+    self:SetAttribute("startingIndex", -1)
+    RegisterAttributeDriver(self, "state-visibility", "show")
+    self.dirtyWidth, self.dirtyHeight = self:GetSize()
+    RegisterAttributeDriver(self, "state-visibility", "[@raid1, exists] show;hide")
+    self:SetAttribute("startingIndex", 1)
+    self:SetAttribute("point", "BOTTOM")
+    self:SetAttribute("columnAnchorPoint", "LEFT")
+    DetachSubFrames(self:GetChildren())
+    self:SetAttribute("yOffset", 7)
+
+    if not self.positioned then
+        self:ClearAllPoints()
+        self:Point("TOPLEFT", SV.UIParent, "TOPLEFT", 4, -40)
+        SV.Mentalo:Add(self, L["Tank Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40")
+        self.Avatar.positionOverride = "TOPLEFT"
+        self:SetAttribute("minHeight", self.dirtyHeight)
+        self:SetAttribute("minWidth", self.dirtyWidth)
+        self.positioned = true
+    end
+
+    local childFrame, childName, petFrame, targetFrame
+    for i = 1, self:GetNumChildren() do
+        childFrame = select(i, self:GetChildren())
+        childFrame:UnitUpdate()
+
+        childName = childFrame:GetName()
+        petFrame = _G[("%sPet"):format(childName)]
+        targetFrame = _G[("%sTarget"):format(childName)]
+
+        if(petFrame) then
+            petFrame:UnitUpdate()
+        end
+        if(targetFrame) then
+            targetFrame:UnitUpdate()
+        end
+    end
+end
+
+BuildTemplates["tank"] = function(self, unit)
+    local key = "tank"
+    local db = SV.db.SVUnit[key]
+    self.unit = unit
+    self.___key = key
+    self:SetScript("OnEnter", UnitFrame_OnEnter)
+    self:SetScript("OnLeave", UnitFrame_OnLeave)
+    MOD:SetActionPanel(self, key)
+    self.Health = MOD:CreateHealthBar(self, true)
+    self.RaidIcon = MOD:CreateRaidIcon(self)
+    self.RaidIcon:SetPoint("BOTTOMRIGHT")
+
+    self.Restrict = RestrictElement
+    self.Allow = AllowElement
+    self.UnitUpdate = TankUnitUpdate
+
+    self.Range = { insideAlpha = 1, outsideAlpha = 1 }
+    self.originalParent = self:GetParent()
+
+    self:UnitUpdate()
+    return self
+end
+--[[
+##########################################################
+ASSIST
+##########################################################
+]]--
+local AssistUnitUpdate = function(self)
+    local token = "assist"
+    local db = SV.db.SVUnit[token]
+    self.colors = oUF_Villain.colors;
+    self:RegisterForClicks(SV.db.SVUnit.fastClickTarget and "AnyDown" or "AnyUp")
+    MOD.RefreshUnitMedia(self, token)
+    if self.isChild and self.originalParent then
+        local targets = db.targetsGroup;
+        if not self.originalParent.childList then
+            self.originalParent.childList = {}
+        end
+        self.originalParent.childList[self] = true;
+        if not InCombatLockdown()then
+            if targets.enable then
+                local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(targets)
+                self:SetParent(self.originalParent)
+                self:Size(UNIT_WIDTH, UNIT_HEIGHT)
+                self:ClearAllPoints()
+                SV:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset)
+            else
+                self:SetParent(SV.Cloaked)
+            end
+        end
+    elseif not InCombatLockdown() then
+        local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(db)
+        self:Size(UNIT_WIDTH, UNIT_HEIGHT)
+    end
+
+    MOD:RefreshUnitLayout(self, token)
+
+    do
+        local nametext = self.InfoPanel.Name;
+        if oUF_Villain.colors.healthclass then
+            self:Tag(nametext, "[name:10]")
+        else
+            self:Tag(nametext, "[name:color][name:10]")
+        end
+    end
+    self:UpdateAllElements()
+end
+
+UpdateTemplates["assist"] = function(self)
+    local token = "assist"
+    local db = SV.db.SVUnit[token]
+
+    self:Hide()
+    DetachSubFrames(self:GetChildren())
+    self:SetAttribute("startingIndex", -1)
+    RegisterAttributeDriver(self, "state-visibility", "show")
+    self.dirtyWidth, self.dirtyHeight = self:GetSize()
+    RegisterAttributeDriver(self, "state-visibility", "[@raid1, exists] show;hide")
+    self:SetAttribute("startingIndex", 1)
+    self:SetAttribute("point", "BOTTOM")
+    self:SetAttribute("columnAnchorPoint", "LEFT")
+    DetachSubFrames(self:GetChildren())
+    self:SetAttribute("yOffset", 7)
+
+    if not self.positioned then
+        self:ClearAllPoints()
+        self:Point("TOPLEFT", SV.UIParent, "TOPLEFT", 4, -140)
+        SV.Mentalo:Add(self, L["Assist Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40")
+        self.Avatar.positionOverride = "TOPLEFT"
+        self:SetAttribute("minHeight", self.dirtyHeight)
+        self:SetAttribute("minWidth", self.dirtyWidth)
+        self.positioned = true
+    end
+
+    local childFrame, childName, petFrame, targetFrame
+    for i = 1, self:GetNumChildren() do
+        childFrame = select(i, self:GetChildren())
+        childFrame:UnitUpdate()
+
+        childName = childFrame:GetName()
+        petFrame = _G[("%sPet"):format(childName)]
+        targetFrame = _G[("%sTarget"):format(childName)]
+
+        if(petFrame) then
+            petFrame:UnitUpdate()
+        end
+        if(targetFrame) then
+            targetFrame:UnitUpdate()
+        end
+    end
+end
+
+BuildTemplates["assist"] = function(self, unit)
+    local key = "assist"
+    local db = SV.db.SVUnit[key]
+    self.unit = unit
+    self.___key = key
+    self:SetScript("OnEnter", UnitFrame_OnEnter)
+    self:SetScript("OnLeave", UnitFrame_OnLeave)
+    MOD:SetActionPanel(self, key)
+    self.Health = MOD:CreateHealthBar(self, true)
+    self.RaidIcon = MOD:CreateRaidIcon(self)
+    self.RaidIcon:SetPoint("BOTTOMRIGHT")
+    self.Range = { insideAlpha = 1, outsideAlpha = 1 }
+
+    self.Restrict = RestrictElement
+    self.Allow = AllowElement
+    self.UnitUpdate = AssistUnitUpdate
+
+    self.originalParent = self:GetParent()
+
+    self:UnitUpdate()
+    return self
+end
+--[[
+##########################################################
+HEADER CONSTRUCTS
+##########################################################
+]]--
+local HeaderMediaUpdate = function(self)
+    local token = self.___groupkey
+    local index = 1;
+    local attIndex = ("child%d"):format(index)
+    local childFrame = self:GetAttribute(attIndex)
+    local childName = childFrame:GetName()
+    local petFrame = _G[("%sPet"):format(childName)]
+    local targetFrame = _G[("%sTarget"):format(childName)]
+
+    while childFrame do
+        MOD.RefreshUnitMedia(childFrame, token)
+
+        if(petFrame) then
+            MOD.RefreshUnitMedia(petFrame, token)
+        end
+
+        if(targetFrame) then
+            MOD.RefreshUnitMedia(targetFrame, token)
+        end
+
+        index = index + 1;
+        attIndex = ("child%d"):format(index)
+        childFrame = self:GetAttribute(attIndex)
+        childName = childFrame:GetName()
+        petFrame = _G[("%sPet"):format(childName)]
+        targetFrame = _G[("%sTarget"):format(childName)]
+    end
+end
+local HeaderUnsetAttributes = function(self)
+    self:Hide()
+    self:SetAttribute("showPlayer", true)
+    self:SetAttribute("showSolo", true)
+    self:SetAttribute("showParty", true)
+    self:SetAttribute("showRaid", true)
+    self:SetAttribute("columnSpacing", nil)
+    self:SetAttribute("columnAnchorPoint", nil)
+    self:SetAttribute("sortMethod", nil)
+    self:SetAttribute("groupFilter", nil)
+    self:SetAttribute("groupingOrder", nil)
+    self:SetAttribute("maxColumns", nil)
+    self:SetAttribute("nameList", nil)
+    self:SetAttribute("point", nil)
+    self:SetAttribute("sortDir", nil)
+    self:SetAttribute("sortMethod", "NAME")
+    self:SetAttribute("startingIndex", nil)
+    self:SetAttribute("strictFiltering", nil)
+    self:SetAttribute("unitsPerColumn", nil)
+    self:SetAttribute("xOffset", nil)
+    self:SetAttribute("yOffset", nil)
+end
+local HeaderEnableChildren = function(self)
+    self.isForced = true;
+    for i=1, select("#", self:GetChildren()) do
+        local childFrame = select(i, self:GetChildren())
+        childFrame:RegisterForClicks(nil)
+        childFrame:SetID(i)
+        childFrame.TargetGlow:SetAlpha(0)
+        childFrame:Allow()
+    end
+end
+local HeaderDisableChildren = function(self)
+    self.isForced = nil;
+    for i=1,select("#", self:GetChildren()) do
+        local childFrame = select(i, self:GetChildren())
+        childFrame:RegisterForClicks(SV.db.SVUnit.fastClickTarget and 'AnyDown' or 'AnyUp')
+        childFrame.TargetGlow:SetAlpha(1)
+        childFrame:Restrict()
+    end
+end
+function MOD:SetGroupHeader(parentFrame, filter, layout, headerName, token)
+    local db = SV.db.SVUnit[token]
+
+    local template1, template2
+    if(token == "raidpet") then
+        template1 = "SVUI_UNITPET"
+        template2 = "SecureGroupPetHeaderTemplate"
+    elseif(token == "tank") then
+        filter = "MAINTANK"
+        template1 = "SVUI_UNITTARGET"
+    elseif(token == "assist") then
+        filter = "MAINASSIST"
+        template1 = "SVUI_UNITTARGET"
+    end
+
+    local UNIT_WIDTH, UNIT_HEIGHT = self:GetActiveSize(db)
+    local groupHeader = oUF_Villain:SpawnHeader(headerName, template2, nil,
+        "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d); self:SetFrameLevel(5)"):format(UNIT_WIDTH, UNIT_HEIGHT),
+        "groupFilter", filter,
+        "showParty", true,
+        "showRaid", true,
+        "showSolo", true,
+        template1 and "template", template1
+    )
+    groupHeader.___groupkey = token
+    groupHeader:SetParent(parentFrame)
+    groupHeader.Update = UpdateTemplates[token]
+    groupHeader.MediaUpdate = HeaderMediaUpdate
+    groupHeader.UnsetAttributes = HeaderUnsetAttributes
+    groupHeader.EnableChildren = HeaderEnableChildren
+    groupHeader.DisableChildren = HeaderDisableChildren
+
+    return groupHeader
+end
+--[[
+##########################################################
+GROUP CONSTRUCTS
+##########################################################
+]]--
+local GroupUpdate = function(self)
+    local token = self.___groupkey
+    if SV.db.SVUnit[token].enable ~= true then
+        UnregisterAttributeDriver(self, "state-visibility")
+        self:Hide()
+        return
+    end
+    for i=1,#self.groups do
+        self.groups[i]:Update()
+    end
+end
+
+local GroupMediaUpdate = function(self)
+    for i=1,#self.groups do
+        self.groups[i]:MediaUpdate()
+    end
+end
+
+local GroupSetVisibility = function(self)
+    if not self.isForced then
+        local token = self.___groupkey
+        local db = SV.db.SVUnit[token]
+        if(db) then
+            for i=1,#self.groups do
+                local frame = self.groups[i]
+                if(i <= db.groupCount) then
+                    frame:Show()
+                else
+                    if frame.forceShow then
+                        frame:Hide()
+                        frame:DisableChildren()
+                        frame:SetAttribute('startingIndex',1)
+                    else
+                        frame:UnsetAttributes()
+                    end
+                end
+            end
+        end
+    end
+end
+
+local GroupConfigure = function(self)
+    local token = self.___groupkey
+    local settings = SV.db.SVUnit[token]
+    local UNIT_WIDTH, UNIT_HEIGHT = MOD:GetActiveSize(settings)
+    local sorting = settings.showBy
+    local sortMethod = settings.sortMethod
+    local widthCalc, heightCalc, xCalc, yCalc = 0, 0, 0, 0;
+    local point, anchorPoint, columnAnchor, horizontal, vertical, isHorizontal = unpack(sortMapping[sorting]);
+    local groupCount = settings.groupCount
+
+    self.groupCount = groupCount
+
+    for i = 1, groupCount do
+
+        local frame = self.groups[i]
+
+        if(frame) then
+            if(settings.showBy == "UP") then
+                settings.showBy = "UP_RIGHT"
+            end
+
+            if(settings.showBy == "DOWN") then
+                settings.showBy = "DOWN_RIGHT"
+            end
+
+            if(isHorizontal) then
+                frame:SetAttribute("xOffset", settings.wrapXOffset * horizontal)
+                frame:SetAttribute("yOffset", 0)
+                frame:SetAttribute("columnSpacing", settings.wrapYOffset)
+            else
+                frame:SetAttribute("xOffset", 0)
+                frame:SetAttribute("yOffset", settings.wrapYOffset * vertical)
+                frame:SetAttribute("columnSpacing", settings.wrapXOffset)
+            end
+
+            if(not frame.isForced) then
+                if not frame.initialized then
+                    frame:SetAttribute("startingIndex", -4)
+                    frame:Show()
+                    frame.initialized = true
+                end
+                frame:SetAttribute("startingIndex", 1)
+            end
+
+            frame:ClearAllPoints()
+            frame:SetAttribute("columnAnchorPoint", columnAnchor)
+
+            DetachSubFrames(frame:GetChildren())
+
+            frame:SetAttribute("point", point)
+
+            if(not frame.isForced) then
+                frame:SetAttribute("maxColumns", 1)
+                frame:SetAttribute("unitsPerColumn", 5)
+                GroupDistributor[sortMethod](frame)
+                frame:SetAttribute("sortDir", settings.sortDir)
+                frame:SetAttribute("showPlayer", settings.showPlayer)
+            end
+
+            frame:SetAttribute("groupFilter", tostring(i))
+        end
+
+        if (i - 1) % settings.gRowCol == 0 then
+            if isHorizontal then
+                if(frame) then
+                    frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical)
+                end
+
+                heightCalc = heightCalc + UNIT_HEIGHT + settings.wrapYOffset;
+                yCalc = yCalc + 1
+            else
+                if(frame) then frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) end
+
+                widthCalc = widthCalc + UNIT_WIDTH + settings.wrapXOffset;
+                xCalc = xCalc + 1
+            end
+        else
+            if isHorizontal then
+                if yCalc == 1 then
+                    if(frame) then
+                        frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0)
+                    end
+
+                    widthCalc = widthCalc + (UNIT_WIDTH + settings.wrapXOffset) * 5;
+                    xCalc = xCalc + 1
+                elseif(frame) then
+                    frame:SetPoint(anchorPoint, self, anchorPoint, (((UNIT_WIDTH + settings.wrapXOffset) * 5) * ((i - 1) % settings.gRowCol)) * horizontal, ((UNIT_HEIGHT + settings.wrapYOffset) * (yCalc - 1)) * vertical)
+                end
+            else
+                if xCalc == 1 then
+                    if(frame) then
+                        frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical)
+                    end
+
+                    heightCalc = heightCalc + (UNIT_HEIGHT + settings.wrapYOffset) * 5;
+                    yCalc = yCalc + 1
+                elseif(frame) then
+                    frame:SetPoint(anchorPoint, self, anchorPoint, ((UNIT_WIDTH + settings.wrapXOffset) * (xCalc - 1)) * horizontal, (((UNIT_HEIGHT + settings.wrapYOffset) * 5) * ((i - 1) % settings.gRowCol)) * vertical)
+                end
+            end
+        end
+
+        if heightCalc == 0 then
+            heightCalc = heightCalc + (UNIT_HEIGHT + settings.wrapYOffset) * 5
+        elseif widthCalc == 0 then
+            widthCalc = widthCalc + (UNIT_WIDTH + settings.wrapXOffset) * 5
+        end
+    end
+
+    self:SetSize(widthCalc - settings.wrapXOffset, heightCalc - settings.wrapYOffset)
+end
+
+function MOD:GetGroupFrame(token, layout)
+    if(not self.Headers[token]) then
+        oUF_Villain:RegisterStyle(layout, BuildTemplates[token])
+        oUF_Villain:SetActiveStyle(layout)
+        local groupFrame = CreateFrame("Frame", layout, SVUI_UnitFrameParent, "SecureHandlerStateTemplate")
+        groupFrame.___groupkey = token;
+        groupFrame.groups = {}
+        groupFrame.Update = GroupUpdate
+        groupFrame.MediaUpdate = GroupMediaUpdate
+        groupFrame.SetVisibility = GroupSetVisibility
+        groupFrame.Configure = GroupConfigure
+
+        groupFrame:Show()
+        self.Headers[token] = groupFrame
+    end
+    return self.Headers[token]
+end
+
+function MOD:SetCustomFrame(token, layout)
+    if(not self.Headers[token]) then
+        oUF_Villain:RegisterStyle(layout, BuildTemplates[token])
+        oUF_Villain:SetActiveStyle(layout)
+        local groupFrame = self:SetGroupHeader(SVUI_UnitFrameParent, nil, layout, layout, token)
+        self.Headers[token] = groupFrame
+    end
+    self.Headers[token]:Show()
+    self.Headers[token]:Update()
+end
+
+function MOD:SetGroupFrame(token, forceUpdate)
+    if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end
+    if(not SV.db.SVUnit.enable) then return end
+    local settings = SV.db.SVUnit[token]
+    local realName = token:gsub("(.)", upper, 1)
+    local layout = "SVUI_"..realName
+
+    if(token == "tank" or token == "assist") then
+        return self:SetCustomFrame(token, layout)
+    end
+
+    local groupFrame = self:GetGroupFrame(token, layout)
+
+    if(token ~= "raidpet" and settings.enable ~= true) then
+        UnregisterStateDriver(groupFrame, "visibility")
+        groupFrame:Hide()
+        return
+    end
+
+    local groupName
+    for i = 1, settings.groupCount do
+        if(not groupFrame.groups[i]) then
+            groupName = layout .. "Group" .. i
+            groupFrame.groups[i] = self:SetGroupHeader(groupFrame, i, layout, groupName, token)
+            groupFrame.groups[i]:Show()
+        end
+    end
+
+    groupFrame:SetVisibility()
+
+    if(forceUpdate or not groupFrame.Avatar) then
+        groupFrame:Configure()
+        if(not groupFrame.isForced and settings.visibility) then
+            RegisterStateDriver(groupFrame, "visibility", settings.visibility)
+        end
+    else
+        groupFrame:Configure()
+        groupFrame:Update()
+    end
+
+    if(token == "raidpet" and settings.enable ~= true) then
+        UnregisterStateDriver(groupFrame, "visibility")
+        groupFrame:Hide()
+        return
+    end
+end
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI/packages/unit/view.lua b/Interface/AddOns/SVUI/packages/unit/view.lua
new file mode 100644
index 0000000..b03d6d5
--- /dev/null
+++ b/Interface/AddOns/SVUI/packages/unit/view.lua
@@ -0,0 +1,229 @@
+--[[
+##############################################################################
+_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_       #
+ ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__      #
+  __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____     #
+   ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____    #
+	______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____   #
+	 _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____  #
+	  __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ #
+	   _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_#
+		___\///////////___________\///___________\/////////_____\///////////_#
+##############################################################################
+S U P E R - V I L L A I N - U I   By: Munglunch                              #
+##############################################################################
+##########################################################
+LOCALIZED LUA FUNCTIONS
+##########################################################
+]]--
+--LUA
+local unpack        = unpack;
+local select        = select;
+local pairs         = pairs;
+local type          = type;
+local rawset        = rawset;
+local rawget        = rawget;
+local tostring      = tostring;
+local error         = error;
+local next          = next;
+local pcall         = pcall;
+local getmetatable  = getmetatable;
+local setmetatable  = setmetatable;
+local assert        = assert;
+--BLIZZARD
+local _G            = _G;
+local tinsert       = _G.tinsert;
+local tremove       = _G.tremove;
+local twipe         = _G.wipe;
+--STRING
+local string        = string;
+local format        = string.format;
+local find          = string.find;
+local match         = string.match;
+--MATH
+local math          = math;
+local min, random   = math.min, math.random;
+--TABLE
+local table         = table;
+--[[ LOCALIZED BLIZZ FUNCTIONS ]]--
+local NewHook = hooksecurefunc;
+--[[
+##########################################################
+GET ADDON DATA AND TEST FOR oUF
+##########################################################
+]]--
+local SV = select(2, ...)
+local oUF_Villain = SV.oUF
+
+assert(oUF_Villain, "SVUI was unable to locate oUF.")
+
+local L = SV.L;
+local MOD = SV.SVUnit
+--[[
+##########################################################
+LOCALS
+##########################################################
+]]--
+local _PRIVATE_ENVIRONMENT;
+local _PRIVATE_FUNCTIONS = {};
+local _PRIVATE_TAGS = {};
+
+local _PRIVATE_METHODS = {
+	UnitPower = function(unit, g)
+		if unit:find('target') or unit:find('focus') then
+			return UnitPower(unit, g)
+		end
+		return random(1, UnitPowerMax(unit, g)or 1)
+	end,
+	UnitHealth = function(unit)
+		if unit:find('target') or unit:find('focus') then
+			return UnitHealth(unit)
+		end
+		return random(1, UnitHealthMax(unit))
+	end,
+	UnitName = function(unit)
+		if unit:find('target') or unit:find('focus') then
+			return UnitName(unit)
+		end
+		return "Dummy"
+	end,
+	UnitClass = function(unit)
+		if unit:find('target') or unit:find('focus') then
+			return UnitClass(unit)
+		end
+		local token = CLASS_SORT_ORDER[random(1, #(CLASS_SORT_ORDER))]
+		return LOCALIZED_CLASS_NAMES_MALE[token], token
+	end,
+	Hex = function(r, g, b)
+		if not r then return end
+		if type(r) == "table" then
+			if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
+		end
+		return ("|cff%02x%02x%02x"):format(r * 255, g * 255, b * 255)
+	end,
+	ColorGradient = oUF_Villain.ColorGradient,
+};
+
+local AttributeChangeHook = function(self)
+	if not self:GetParent().forceShow and not self.forceShow then return end
+	if not self:IsShown() then return end
+
+	local key = self.___groupkey
+	local db = SV.db.SVUnit[key]
+
+	local newIndex = -4;
+	if self:GetAttribute("startingIndex") ~= newIndex then
+		self:SetAttribute("startingIndex", newIndex)
+		self.isForced = true;
+		self:EnableChildren()
+	end
+end;
+
+local function SetProxyEnv()
+	if(_PRIVATE_ENVIRONMENT ~= nil) then return end
+
+	_PRIVATE_ENVIRONMENT = setmetatable(_PRIVATE_METHODS, { __index = _G, __newindex = function(_,key,value) _G[key] = value end });
+
+	for i=1, 30 do
+		_PRIVATE_TAGS['name:'..i] = oUF_Villain.Tags.Methods['name:'..i]
+	end
+
+	_PRIVATE_TAGS['name:color'] = oUF_Villain.Tags.Methods['name:color']
+	_PRIVATE_TAGS['name:grid'] = oUF_Villain.Tags.Methods['name:grid']
+	_PRIVATE_TAGS['health:color'] = oUF_Villain.Tags.Methods['health:color']
+	_PRIVATE_TAGS['health:current'] = oUF_Villain.Tags.Methods['health:current']
+	_PRIVATE_TAGS['health:deficit'] = oUF_Villain.Tags.Methods['health:deficit']
+	_PRIVATE_TAGS['health:curpercent'] = oUF_Villain.Tags.Methods['health:curpercent']
+	_PRIVATE_TAGS['health:curmax'] = oUF_Villain.Tags.Methods['health:curmax']
+	_PRIVATE_TAGS['health:curmax-percent'] = oUF_Villain.Tags.Methods['health:curmax-percent']
+	_PRIVATE_TAGS['health:max'] = oUF_Villain.Tags.Methods['health:max']
+	_PRIVATE_TAGS['health:percent'] = oUF_Villain.Tags.Methods['health:percent']
+	_PRIVATE_TAGS['power:color'] = oUF_Villain.Tags.Methods['power:color']
+	_PRIVATE_TAGS['power:current'] = oUF_Villain.Tags.Methods['power:current']
+	_PRIVATE_TAGS['power:deficit'] = oUF_Villain.Tags.Methods['power:deficit']
+	_PRIVATE_TAGS['power:curpercent'] = oUF_Villain.Tags.Methods['power:curpercent']
+	_PRIVATE_TAGS['power:curmax'] = oUF_Villain.Tags.Methods['power:curmax']
+	_PRIVATE_TAGS['power:curmax-percent'] = oUF_Villain.Tags.Methods['power:curmax-percent']
+	_PRIVATE_TAGS['power:max'] = oUF_Villain.Tags.Methods['power:max']
+	_PRIVATE_TAGS['power:percent'] = oUF_Villain.Tags.Methods['power:percent']
+end
+
+function MOD:ViewEnemyFrames(unit, numGroup)
+	if InCombatLockdown()then return end
+	for i=1, numGroup do
+		local unitName = unit..i
+		local frame = self.Units[unitName]
+		if(frame and frame.Allow) then
+			if(not frame.isForced) then
+				frame:Allow()
+			else
+				frame:Restrict()
+			end
+		end
+	end
+end
+
+function MOD:ViewGroupFrames(headerFrame, setForced)
+	if InCombatLockdown() then return end
+	if(not headerFrame) then return end
+	SetProxyEnv()
+
+	headerFrame.forceShow = setForced;
+	headerFrame.forceShowAuras = setForced;
+	headerFrame.isForced = setForced;
+	local raidToken = headerFrame.___groupkey
+
+	if setForced then
+		for _, func in pairs(_PRIVATE_TAGS) do
+			if type(func) == "function" then
+				if(not _PRIVATE_FUNCTIONS[func]) then
+					_PRIVATE_FUNCTIONS[func] = getfenv(func)
+					setfenv(func, _PRIVATE_ENVIRONMENT)
+				end
+			end
+		end
+		RegisterStateDriver(headerFrame, "visibility", "show")
+	else
+		for func, fenv in pairs(_PRIVATE_FUNCTIONS)do
+			setfenv(func, fenv)
+			_PRIVATE_FUNCTIONS[func] = nil
+		end
+
+		local db = SV.db.SVUnit[raidToken]
+		RegisterStateDriver(headerFrame, "visibility", db.visibility)
+		local eventScript = headerFrame:GetScript("OnEvent")
+		if eventScript then
+			eventScript(headerFrame, "PLAYER_ENTERING_WORLD")
+		end
+	end
+
+	for i = 1, #headerFrame.groups do
+		local groupFrame = headerFrame.groups[i]
+
+		if(groupFrame:IsShown()) then
+			groupFrame.forceShow = headerFrame.forceShow;
+			groupFrame.forceShowAuras = headerFrame.forceShowAuras;
+			groupFrame:HookScript("OnAttributeChanged", AttributeChangeHook)
+
+			if setForced then
+				groupFrame:SetAttribute("showRaid", nil)
+				groupFrame:SetAttribute("showParty", nil)
+				groupFrame:SetAttribute("showSolo", nil)
+
+				AttributeChangeHook(groupFrame)
+				groupFrame:Update()
+			else
+				groupFrame:SetAttribute("showRaid", true)
+				groupFrame:SetAttribute("showParty", true)
+				groupFrame:SetAttribute("showSolo", true)
+
+				groupFrame:DisableChildren()
+				groupFrame:SetAttribute("startingIndex", 1)
+				groupFrame:Update()
+			end
+		end
+	end
+
+	headerFrame:SetVisibility()
+	collectgarbage("collect")
+end
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI/xml/widgets.xml b/Interface/AddOns/SVUI/xml/widgets.xml
index 31322cd..4604030 100644
--- a/Interface/AddOns/SVUI/xml/widgets.xml
+++ b/Interface/AddOns/SVUI/xml/widgets.xml
@@ -1151,7 +1151,7 @@

     <Frame name="SVUI_PanelTemplate_UnitSmall" virtual="true">
         <Attributes>
-            <Attribute name="panelID" type="string" value="unitsmall" />
+            <Attribute name="panelID" type="string" value="unitlarge" />
             <Attribute name="panelPadding" type="number" value="0" />
             <Attribute name="panelColor" type="string" value="special" />
             <Attribute name="panelGradient" type="boolean" value="false" />
diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/units/grid.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/units/grid.lua
index 85a97b7..ee85731 100644
--- a/Interface/AddOns/SVUI_ConfigOMatic/components/units/grid.lua
+++ b/Interface/AddOns/SVUI_ConfigOMatic/components/units/grid.lua
@@ -49,7 +49,7 @@ SV.Options.args.SVUnit.args.grid = {
 			order = 1,
 			type = "execute",
 			name = L["Display Frames"],
-			func = function()MOD:ViewGroupFrames(_G["SVUI_Raid40"], _G["SVUI_Raid40"].forceShow ~= true or nil)end,
+			func = function()MOD:ViewGroupFrames(_G["SVUI_Raid40"], _G["SVUI_Raid40"].forceShow ~= true or nil, "raid40")end,
 		},
 		gridCommon = {
 			order = 2,
@@ -112,7 +112,7 @@ SV.Options.args.SVUnit.args.grid = {
 					name = L['Party Grid'],
 					desc = L['If grid-mode is enabled, these units will be changed.'],
 					get = function(key) return SV.db.SVUnit.party.gridAllowed end,
-					set = function(key, value) SV.db.SVUnit.party.gridAllowed = value; MOD:SetGroupFrame("party") end,
+					set = function(key, value) SV.db.SVUnit.party.gridAllowed = value; MOD:SetGroupFrame() end,
 				},
 				partypets = {
 					type = 'toggle',
@@ -120,7 +120,7 @@ SV.Options.args.SVUnit.args.grid = {
 					name = L['Party Pets Grid'],
 					desc = L['If grid-mode is enabled, these units will be changed.'],
 					get = function(key) return SV.db.SVUnit.party.petsGroup.gridAllowed end,
-					set = function(key, value) SV.db.SVUnit.party.petsGroup.gridAllowed = value; MOD:SetGroupFrame("party") end,
+					set = function(key, value) SV.db.SVUnit.party.petsGroup.gridAllowed = value; MOD:SetGroupFrame() end,
 				},
 				partytargets = {
 					type = 'toggle',
@@ -128,39 +128,39 @@ SV.Options.args.SVUnit.args.grid = {
 					name = L['Party Targets Grid'],
 					desc = L['If grid-mode is enabled, these units will be changed.'],
 					get = function(key) return SV.db.SVUnit.party.targetsGroup.gridAllowed end,
-					set = function(key, value) SV.db.SVUnit.party.targetsGroup.gridAllowed = value; MOD:SetGroupFrame("party") end,
+					set = function(key, value) SV.db.SVUnit.party.targetsGroup.gridAllowed = value; MOD:SetGroupFrame() end,
 				},
 				raid10 = {
 					type = 'toggle',
 					order = 4,
-					name = L['Raid 10 Grid'],
+					name = L['Raid Grid'],
 					desc = L['If grid-mode is enabled, these units will be changed.'],
 					get = function(key) return SV.db.SVUnit.raid10.gridAllowed end,
-					set = function(key, value) SV.db.SVUnit.raid10.gridAllowed = value; MOD:SetGroupFrame("raid10") end,
+					set = function(key, value) SV.db.SVUnit.raid10.gridAllowed = value; MOD:SetGroupFrame("raid10"); end,
 				},
 				raid25 = {
 					type = 'toggle',
 					order = 5,
-					name = L['Raid 25 Grid'],
+					name = L['Raid Grid'],
 					desc = L['If grid-mode is enabled, these units will be changed.'],
 					get = function(key) return SV.db.SVUnit.raid25.gridAllowed end,
-					set = function(key, value) SV.db.SVUnit.raid25.gridAllowed = value; MOD:SetGroupFrame("raid25") end,
+					set = function(key, value) SV.db.SVUnit.raid25.gridAllowed = value; MOD:SetGroupFrame("raid25"); end,
 				},
 				raid40 = {
 					type = 'toggle',
 					order = 6,
-					name = L['Raid 40 Grid'],
+					name = L['Raid Grid'],
 					desc = L['If grid-mode is enabled, these units will be changed.'],
 					get = function(key) return SV.db.SVUnit.raid40.gridAllowed end,
 					set = function(key, value) SV.db.SVUnit.raid40.gridAllowed = value; MOD:SetGroupFrame("raid40") end,
 				},
 				raidpet = {
 					type = 'toggle',
-					order = 4,
+					order = 7,
 					name = L['Raid Pet Grid'],
 					desc = L['If grid-mode is enabled, these units will be changed.'],
 					get = function(key) return SV.db.SVUnit.raidpet.gridAllowed end,
-					set = function(key, value) SV.db.SVUnit.raidpet.gridAllowed = value; MOD:SetGroupFrame("raidpet") end,
+					set = function(key, value) SV.db.SVUnit.raidpet.gridAllowed = value; MOD:SetGroupFrame() end,
 				},
 			}
 		},
diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/units/other.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/units/other.lua
index 983463e..90305ee 100644
--- a/Interface/AddOns/SVUI_ConfigOMatic/components/units/other.lua
+++ b/Interface/AddOns/SVUI_ConfigOMatic/components/units/other.lua
@@ -45,7 +45,7 @@ SV.Options.args.SVUnit.args.boss = {
 	order = 1000,
 	childGroups = "tab",
 	get = function(l)return SV.db.SVUnit["boss"][l[#l]]end,
-	set = function(l, m)MOD:ChangeDBVar(m, l[#l], "boss");MOD:SetEnemyFrames("boss", MAX_BOSS_FRAMES)end,
+	set = function(l, m)MOD:ChangeDBVar(m, l[#l], "boss");MOD:SetEnemyFrame("boss", MAX_BOSS_FRAMES)end,
 	args = {
 		enable = {type = "toggle", order = 1, name = L["Enable"]},
 		displayFrames = {type = "execute", order = 2, name = L["Display Frames"], desc = L["Force the frames to show, they will act as if they are the player frame."], func = function()MOD:ViewEnemyFrames("boss", 4)end},
@@ -74,7 +74,7 @@ SV.Options.args.SVUnit.args.boss = {
 									name = "",
 								},
 								rangeCheck = {order = 3, name = L["Range Check"], desc = L["Check if you are in range to cast spells on this specific unit."], type = "toggle"},
-								hideonnpc = {type = "toggle", order = 4, name = L["Text Toggle On NPC"], desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."], get = function(l)return SV.db.SVUnit["boss"]["power"].hideonnpc end, set = function(l, m)SV.db.SVUnit["boss"]["power"].hideonnpc = m;MOD:SetEnemyFrames("boss")end},
+								hideonnpc = {type = "toggle", order = 4, name = L["Text Toggle On NPC"], desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."], get = function(l)return SV.db.SVUnit["boss"]["power"].hideonnpc end, set = function(l, m)SV.db.SVUnit["boss"]["power"].hideonnpc = m;MOD:SetEnemyFrame("boss")end},
 								threatEnabled = {type = "toggle", order = 5, name = L["Show Threat"]}
 							}
 						},
@@ -90,15 +90,15 @@ SV.Options.args.SVUnit.args.boss = {
 						},
 					}
 				},
-				misc = ns:SetMiscConfigGroup(false, MOD.SetEnemyFrames, "boss", MAX_BOSS_FRAMES),
-				health = ns:SetHealthConfigGroup(false, MOD.SetEnemyFrames, "boss", MAX_BOSS_FRAMES),
-				power = ns:SetPowerConfigGroup(false, MOD.SetEnemyFrames, "boss", MAX_BOSS_FRAMES),
-				name = ns:SetNameConfigGroup(MOD.SetEnemyFrames, "boss", MAX_BOSS_FRAMES),
-				portrait = ns:SetPortraitConfigGroup(MOD.SetEnemyFrames, "boss", MAX_BOSS_FRAMES),
-				buffs = ns:SetAuraConfigGroup(true, "buffs", false, MOD.SetEnemyFrames, "boss", MAX_BOSS_FRAMES),
-				debuffs = ns:SetAuraConfigGroup(true, "debuffs", false, MOD.SetEnemyFrames, "boss", MAX_BOSS_FRAMES),
-				castbar = ns:SetCastbarConfigGroup(MOD.SetEnemyFrames, "boss", MAX_BOSS_FRAMES),
-				icons = ns:SetIconConfigGroup(MOD.SetEnemyFrames, "boss", MAX_BOSS_FRAMES)
+				misc = ns:SetMiscConfigGroup(false, MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
+				health = ns:SetHealthConfigGroup(false, MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
+				power = ns:SetPowerConfigGroup(false, MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
+				name = ns:SetNameConfigGroup(MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
+				portrait = ns:SetPortraitConfigGroup(MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
+				buffs = ns:SetAuraConfigGroup(true, "buffs", false, MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
+				debuffs = ns:SetAuraConfigGroup(true, "debuffs", false, MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
+				castbar = ns:SetCastbarConfigGroup(MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
+				icons = ns:SetIconConfigGroup(MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES)
 			}
 		}
 	}
@@ -114,7 +114,7 @@ SV.Options.args.SVUnit.args.arena = {
 	order = 1100,
 	childGroups = "tab",
 	get = function(l)return SV.db.SVUnit["arena"][l[#l]]end,
-	set = function(l, m)MOD:ChangeDBVar(m, l[#l], "arena");MOD:SetEnemyFrames("arena", 5)end,
+	set = function(l, m)MOD:ChangeDBVar(m, l[#l], "arena");MOD:SetEnemyFrame("arena", 5)end,
 	args = {
 		enable = {type = "toggle", order = 1, name = L["Enable"]},
 		displayFrames = {type = "execute", order = 2, name = L["Display Frames"], desc = L["Force the frames to show, they will act as if they are the player frame."], func = function()MOD:ViewEnemyFrames("arena", 5)end},
@@ -144,7 +144,7 @@ SV.Options.args.SVUnit.args.arena = {
 								},
 								predict = {order = 3, name = L["Heal Prediction"], desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."], type = "toggle"},
 								rangeCheck = {order = 4, name = L["Range Check"], desc = L["Check if you are in range to cast spells on this specific unit."], type = "toggle"},
-								hideonnpc = {type = "toggle", order = 5, name = L["Text Toggle On NPC"], desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."], get = function(l)return SV.db.SVUnit["arena"]["power"].hideonnpc end, set = function(l, m)SV.db.SVUnit["arena"]["power"].hideonnpc = m;MOD:SetEnemyFrames("arena")end},
+								hideonnpc = {type = "toggle", order = 5, name = L["Text Toggle On NPC"], desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."], get = function(l)return SV.db.SVUnit["arena"]["power"].hideonnpc end, set = function(l, m)SV.db.SVUnit["arena"]["power"].hideonnpc = m;MOD:SetEnemyFrame("arena")end},
 								threatEnabled = {type = "toggle", order = 6, name = L["Show Threat"]}
 							}
 						},
@@ -169,7 +169,7 @@ SV.Options.args.SVUnit.args.arena = {
 									order = 1,
 									name = L["Enable"],
 									get = function(l)return SV.db.SVUnit.arena.pvp.enable end,
-									set = function(l, m)MOD:ChangeDBVar(m, "enable", "arena", "pvp");MOD:SetEnemyFrames("arena", 5)end,
+									set = function(l, m)MOD:ChangeDBVar(m, "enable", "arena", "pvp");MOD:SetEnemyFrame("arena", 5)end,
 								},
 								trinketGroup = {
 									order = 2,
@@ -177,7 +177,7 @@ SV.Options.args.SVUnit.args.arena = {
 									type = "group",
 									name = L["Trinkets"],
 									get = function(l)return SV.db.SVUnit.arena.pvp[l[#l]]end,
-									set = function(l, m)MOD:ChangeDBVar(m, l[#l], "arena", "pvp");MOD:SetEnemyFrames("arena", 5)end,
+									set = function(l, m)MOD:ChangeDBVar(m, l[#l], "arena", "pvp");MOD:SetEnemyFrame("arena", 5)end,
 									disabled = function() return not SV.db.SVUnit.arena.pvp.enable end,
 									args = {
 										trinketPosition = {
@@ -221,7 +221,7 @@ SV.Options.args.SVUnit.args.arena = {
 									type = "group",
 									name = L["Enemy Specs"],
 									get = function(l)return SV.db.SVUnit.arena.pvp[l[#l]]end,
-									set = function(l, m)MOD:ChangeDBVar(m, l[#l], "arena", "pvp");MOD:SetEnemyFrames("arena", 5)end,
+									set = function(l, m)MOD:ChangeDBVar(m, l[#l], "arena", "pvp");MOD:SetEnemyFrame("arena", 5)end,
 									disabled = function() return not SV.db.SVUnit.arena.pvp.enable end,
 									args = {
 										specPosition = {
@@ -263,13 +263,13 @@ SV.Options.args.SVUnit.args.arena = {
 						},
 					}
 				},
-				misc = ns:SetMiscConfigGroup(false, MOD.SetEnemyFrames, "arena", 5),
-				health = ns:SetHealthConfigGroup(false, MOD.SetEnemyFrames, "arena", 5),
-				power = ns:SetPowerConfigGroup(false, MOD.SetEnemyFrames, "arena", 5),
-				name = ns:SetNameConfigGroup(MOD.SetEnemyFrames, "arena", 5),
-				buffs = ns:SetAuraConfigGroup(false, "buffs", false, MOD.SetEnemyFrames, "arena", 5),
-				debuffs = ns:SetAuraConfigGroup(false, "debuffs", false, MOD.SetEnemyFrames, "arena", 5),
-				castbar = ns:SetCastbarConfigGroup(MOD.SetEnemyFrames, "arena", 5)
+				misc = ns:SetMiscConfigGroup(false, MOD.SetEnemyFrame, "arena", 5),
+				health = ns:SetHealthConfigGroup(false, MOD.SetEnemyFrame, "arena", 5),
+				power = ns:SetPowerConfigGroup(false, MOD.SetEnemyFrame, "arena", 5),
+				name = ns:SetNameConfigGroup(MOD.SetEnemyFrame, "arena", 5),
+				buffs = ns:SetAuraConfigGroup(false, "buffs", false, MOD.SetEnemyFrame, "arena", 5),
+				debuffs = ns:SetAuraConfigGroup(false, "debuffs", false, MOD.SetEnemyFrame, "arena", 5),
+				castbar = ns:SetCastbarConfigGroup(MOD.SetEnemyFrame, "arena", 5)
 			}
 		}
 	}
diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/units/party.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/units/party.lua
index 2ca39ac..c8108ce 100644
--- a/Interface/AddOns/SVUI_ConfigOMatic/components/units/party.lua
+++ b/Interface/AddOns/SVUI_ConfigOMatic/components/units/party.lua
@@ -74,6 +74,14 @@ SV.Options.args.SVUnit.args.party = {
 					type = 'group',
 					name = L['General'],
 					args = {
+						showPlayer = {
+							order = 1,
+							type = 'toggle',
+							name = L['Display Player'],
+							desc = L['When true, always show player in party frames'],
+							get = function(l)return SV.db.SVUnit.party.showPlayer end,
+							set = function(l, m) MOD:ChangeDBVar(m, l[#l], "party"); MOD:SetGroupFrame("party", true) end,
+						},
 						hideonnpc = {
 							type = 'toggle',
 							order = 2,
@@ -121,7 +129,7 @@ SV.Options.args.SVUnit.args.party = {
 							name = L['Size and Positions'],
 							type = 'group',
 							guiInline = true,
-							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party', nil, nil, true)end,
+							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party', true)end,
 							args = {
 								width = {
 									order = 1,
@@ -163,40 +171,8 @@ SV.Options.args.SVUnit.args.party = {
 										LEFT_UP = format(L['%s and then %s'], L['Left'], L['Up']),
 									},
 								},
-								groupCount = {
-									order = 5,
-									type = 'range',
-									name = L['Number of Groups'],
-									min = 1,
-									max = 8,
-									step = 1,
-									set = function(l, m)
-										MOD:ChangeDBVar(m, l[#l], "party");
-										MOD:SetGroupFrame('party')
-										if SVUI_Party.isForced then
-											MOD:ViewGroupFrames(SVUI_Party)
-											MOD:ViewGroupFrames(SVUI_Party, true)
-										end
-									end,
-								},
-								gRowCol = {
-									order = 6,
-									type = 'range',
-									name = L['Groups Per Row/Column'],
-									min = 1,
-									max = 8,
-									step = 1,
-									set = function(l, m)
-										MOD:ChangeDBVar(m, l[#l], "party");
-										MOD:SetGroupFrame('party')
-										if SVUI_Party.isForced then
-											MOD:ViewGroupFrames(SVUI_Party)
-											MOD:ViewGroupFrames(SVUI_Party, true)
-										end
-									end,
-								},
 								wrapXOffset = {
-									order = 7,
+									order = 5,
 									type = 'range',
 									name = L['Horizontal Spacing'],
 									min = 0,
@@ -204,7 +180,7 @@ SV.Options.args.SVUnit.args.party = {
 									step = 1,
 								},
 								wrapYOffset = {
-									order = 8,
+									order = 6,
 									type = 'range',
 									name = L['Vertical Spacing'],
 									min = 0,
@@ -213,35 +189,12 @@ SV.Options.args.SVUnit.args.party = {
 								},
 							},
 						},
-						visibilityGroup = {
-							order = 200,
-							name = L['Visibility'],
-							type = 'group',
-							guiInline = true,
-							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party', nil, nil, true)end,
-							args = {
-								showPlayer = {
-									order = 1,
-									type = 'toggle',
-									name = L['Display Player'],
-									desc = L['When true, the header includes the player when not in a raid.'],
-								},
-								visibility = {
-									order = 2,
-									type = 'input',
-									name = L['Visibility'],
-									desc = L['The following macro must be true in order for the group to be shown, in addition to any filter that may already be set.'],
-									width = 'full',
-									desc = L['TEXT_FORMAT_DESC'],
-								},
-							},
-						},
 						sortingGroup = {
 							order = 300,
 							type = 'group',
 							guiInline = true,
 							name = L['Grouping & Sorting'],
-							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party', nil, nil, true)end,
+							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party");MOD:SetGroupFrame('party', true)end,
 							args = {
 								sortMethod = {
 									order = 1,
@@ -274,26 +227,13 @@ SV.Options.args.SVUnit.args.party = {
 									width = 'full',
 									name = ' ',
 								},
-								customSorting = {
-									order = 4,
-									name = L['Custom Sorting'],
-									desc = L['Enabling this allows unique sorting.'],
-									type = 'toggle',
-								},
 								invertGroupingOrder = {
-									order = 5,
+									order = 4,
 									name = L['Invert Grouping Order'],
 									desc = L['Enabling this inverts the sorting order.'],
 									disabled = function()return not SV.db.SVUnit['party'].customSorting end,
 									type = 'toggle',
 								},
-								startFromCenter = {
-									order = 6,
-									name = L['Start Near Center'],
-									desc = L['The initial group will start near the center and grow out.'],
-									disabled = function()return not SV.db.SVUnit['party'].customSorting end,
-									type = 'toggle',
-								},
 							},
 						},

diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/units/raid.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/units/raid.lua
index 035abbf..5572eac 100644
--- a/Interface/AddOns/SVUI_ConfigOMatic/components/units/raid.lua
+++ b/Interface/AddOns/SVUI_ConfigOMatic/components/units/raid.lua
@@ -35,19 +35,26 @@ local MOD = SV.SVUnit
 if(not MOD) then return end
 local _, ns = ...

+local RaidCategories = {
+	[10] = "Raid (10)",
+	[25] = "Raid (15,20,25)",
+	[40] = "Raid (40)",
+}
+
 local subOrder = 11;
-for w=10,40,15 do
+for w=10,40,15 do
+	local raidToken = ("raid%d"):format(w)
+	local raidGlobal = ("SVUI_Raid%d"):format(w)
 	subOrder = subOrder + 1
-	SV.Options.args.SVUnit.args["raid" .. w] = {
-		name = L["Raid-" .. w .. " Frames"],
+	SV.Options.args.SVUnit.args[raidToken] = {
+		name = RaidCategories[w],
 		type = "group",
 		order = subOrder,
 		childGroups = "tab",
-		get = function(l) return SV.db.SVUnit["raid" .. w][l[#l]] end,
-		set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w)end,
+		get = function(l) return SV.db.SVUnit[raidToken][l[#l]] end,
+		set = function(l, m) MOD:ChangeDBVar(m, l[#l], raidToken); MOD:SetGroupFrame(raidToken) end,
 		args = {
-			enable =
-			{
+			enable = {
 				type = "toggle",
 				order = 1,
 				name = L["Enable"],
@@ -56,13 +63,16 @@ for w=10,40,15 do
 				order = 2,
 				type = "execute",
 				name = L["Display Frames"],
-				func = function()MOD:ViewGroupFrames(_G["SVUI_Raid" .. w], _G["SVUI_Raid" .. w].forceShow ~= true or nil)end,
+				func = function()
+					local setForced = (_G[raidGlobal].forceShow ~= true) or nil;
+					MOD:ViewGroupFrames(_G[raidGlobal], setForced)
+				end,
 			},
 			resetSettings = {
 				type = "execute",
 				order = 3,
 				name = L["Restore Defaults"],
-				func = function(l, m)MOD:ResetUnitOptions("raid" .. w)SV.Mentalo:Reset("Raid 1-" .. w .. " Frames")end,
+				func = function(l, m)MOD:ResetUnitOptions(raidToken) SV.Mentalo:Reset("Raid Frames") end,
 			},
 			tabGroups = {
 				order = 3,
@@ -75,40 +85,49 @@ for w=10,40,15 do
 						type = "group",
 						name = L["General Settings"],
 						args = {
+							showPlayer =
+							{
+								order = 1,
+								type = "toggle",
+								name = L["Display Player"],
+								desc = L["When true, always show player in raid frames."],
+								get = function(l)return SV.db.SVUnit[raidToken].showPlayer end,
+								set = function(l, m) MOD:ChangeDBVar(m, l[#l], raidToken); MOD:SetGroupFrame(raidToken, true) end,
+							},
 							hideonnpc =
 							{
 								type = "toggle",
-								order = 1,
+								order = 2,
 								name = L["Text Toggle On NPC"],
 								desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."],
-								get = function(l)return SV.db.SVUnit["raid" .. w]["power"].hideonnpc end,
-								set = function(l, m)SV.db.SVUnit["raid" .. w]["power"].hideonnpc = m;MOD:SetGroupFrame("raid" .. w)end,
+								get = function(l)return SV.db.SVUnit[raidToken]["power"].hideonnpc end,
+								set = function(l, m) SV.db.SVUnit[raidToken]["power"].hideonnpc = m; MOD:SetGroupFrame(raidToken)end,
 							},
 							rangeCheck = {
-								order = 2,
+								order = 3,
 								name = L["Range Check"],
 								desc = L["Check if you are in range to cast spells on this specific unit."],
 								type = "toggle",
 							},
 							gps = {
-								order = 3,
+								order = 4,
 								name = "GPS Tracking",
 								desc = "Show an arrow giving the direction and distance to the frames unit.",
 								type = "toggle",
 							},
 							predict = {
-								order = 4,
+								order = 5,
 								name = L["Heal Prediction"],
 								desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."],
 								type = "toggle",
 							},
 							threatEnabled = {
 								type = "toggle",
-								order = 5,
+								order = 6,
 								name = L["Show Threat"],
 							},
 							colorOverride = {
-								order = 6,
+								order = 7,
 								name = L["Class Color Override"],
 								desc = L["Override the default class color setting."],
 								type = "select",
@@ -124,7 +143,7 @@ for w=10,40,15 do
 								name = L["Size and Positions"],
 								type = "group",
 								guiInline = true,
-								set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w, nil, nil, true)end,
+								set = function(l, m)MOD:ChangeDBVar(m, l[#l], raidToken);MOD:SetGroupFrame(raidToken, true)end,
 								args =
 								{
 									width =
@@ -135,7 +154,7 @@ for w=10,40,15 do
 										min = 10,
 										max = 500,
 										step = 1,
-										set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w)end,
+										set = function(l, m)MOD:ChangeDBVar(m, l[#l], raidToken);MOD:SetGroupFrame(raidToken)end,
 									},
 									height =
 									{
@@ -145,7 +164,7 @@ for w=10,40,15 do
 										min = 10,
 										max = 500,
 										step = 1,
-										set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w)end,
+										set = function(l, m)MOD:ChangeDBVar(m, l[#l], raidToken);MOD:SetGroupFrame(raidToken)end,
 									},
 									spacer =
 									{
@@ -171,44 +190,27 @@ for w=10,40,15 do
 											LEFT_DOWN = format(L["%s and then %s"], L["Left"], L["Down"]),
 											LEFT_UP = format(L["%s and then %s"], L["Left"], L["Up"]),
 										},
-									},
-									groupCount =
-									{
-										order = 5,
-										type = "range",
-										name = L["Number of Groups"],
-										min = 1,
-										max = 8,
-										step = 1,
-										set = function(l, m)
-											MOD:ChangeDBVar(m, l[#l], "raid" .. w);
-											MOD:SetGroupFrame("raid" .. w)
-											if _G["SVUI_Raid" .. w].isForced then
-												MOD:ViewGroupFrames(_G["SVUI_Raid" .. w])
-												MOD:ViewGroupFrames(_G["SVUI_Raid" .. w], true)
-											end
-										end,
-									},
+									},
 									gRowCol =
 									{
-										order = 6,
+										order = 5,
 										type = "range",
 										name = L["Groups Per Row / Column"],
 										min = 1,
 										max = 8,
 										step = 1,
 										set = function(l, m)
-											MOD:ChangeDBVar(m, l[#l], "raid" .. w);
-											MOD:SetGroupFrame("raid" .. w)
-											if _G["SVUI_Raid" .. w].isForced then
-												MOD:ViewGroupFrames(_G["SVUI_Raid" .. w])
-												MOD:ViewGroupFrames(_G["SVUI_Raid" .. w], true)
+											MOD:ChangeDBVar(m, l[#l], raidToken);
+											MOD:SetGroupFrame(raidToken)
+											if(_G[raidGlobal] and _G[raidGlobal].isForced) then
+												MOD:ViewGroupFrames(_G[raidGlobal])
+												MOD:ViewGroupFrames(_G[raidGlobal], true)
 											end
 										end,
 									},
 									wrapXOffset =
 									{
-										order = 7,
+										order = 6,
 										type = "range",
 										name = L["Horizontal Spacing"],
 										min = 0,
@@ -217,7 +219,7 @@ for w=10,40,15 do
 									},
 									wrapYOffset =
 									{
-										order = 8,
+										order = 7,
 										type = "range",
 										name = L["Vertical Spacing"],
 										min = 0,
@@ -225,39 +227,13 @@ for w=10,40,15 do
 										step = 1,
 									},
 								},
-							},
-							visibilityGroup = {
-								order = 200,
-								name = L["Visibility"],
-								type = "group",
-								guiInline = true,
-								set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w, nil, nil, true)end,
-								args =
-								{
-									showPlayer =
-									{
-										order = 1,
-										type = "toggle",
-										name = L["Display Player"],
-										desc = L["When true, the header includes the player when not in a raid."],
-									},
-									visibility =
-									{
-										order = 2,
-										type = "input",
-										name = L["Visibility"],
-										desc = L["The following macro must be true in order for the group to be shown, in addition to any filter that may already be set."],
-										width = "full",
-										desc = L["TEXT_FORMAT_DESC"],
-									},
-								},
-							},
+							},
 							sortingGroup = {
 								order = 300,
 								type = "group",
 								guiInline = true,
 								name = L["Sorting"],
-								set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w);MOD:SetGroupFrame("raid" .. w, nil, nil, true)end,
+								set = function(l, m)MOD:ChangeDBVar(m, l[#l], raidToken);MOD:SetGroupFrame(raidToken, true)end,
 								args =
 								{
 									sortMethod =
@@ -296,40 +272,25 @@ for w=10,40,15 do
 										type = "description",
 										width = "full",
 										name = " ",
-									},
-									customSorting =
-									{
-										order = 4,
-										name = L["Raid-Wide Sorting"],
-										desc = L["Enabling this allows raid-wide sorting however you will not be able to distinguish between groups."],
-										type = "toggle",
-									},
+									},
 									invertGroupingOrder =
 									{
-										order = 5,
+										order = 4,
 										name = L["Invert Grouping Order"],
 										desc = L["Enabling this inverts the grouping order when the raid is not full, this will reverse the direction it starts from."],
-										disabled = function()return not SV.db.SVUnit["raid" .. w].customSorting end,
+										disabled = function()return not SV.db.SVUnit[raidToken].customSorting end,
 										type = "toggle",
-									},
-									startFromCenter =
-									{
-										order = 6,
-										name = L["Start Near Center"],
-										desc = L["The initial group will start near the center and grow out."],
-										disabled = function()return not SV.db.SVUnit["raid" .. w].customSorting end,
-										type = "toggle",
-									},
+									},
 								},
 							}
 						}
 					},
-					misc = ns:SetMiscConfigGroup(true, MOD.SetGroupFrame, "raid" .. w),
-					health = ns:SetHealthConfigGroup(true, MOD.SetGroupFrame, "raid" .. w),
-					power = ns:SetPowerConfigGroup(false, MOD.SetGroupFrame, "raid" .. w),
-					name = ns:SetNameConfigGroup(MOD.SetGroupFrame, "raid" .. w),
-					buffs = ns:SetAuraConfigGroup(true, "buffs", true, MOD.SetGroupFrame, "raid" .. w),
-					debuffs = ns:SetAuraConfigGroup(true, "debuffs", true, MOD.SetGroupFrame, "raid" .. w),
+					misc = ns:SetMiscConfigGroup(true, MOD.SetGroupFrame, raidToken),
+					health = ns:SetHealthConfigGroup(true, MOD.SetGroupFrame, raidToken),
+					power = ns:SetPowerConfigGroup(false, MOD.SetGroupFrame, raidToken),
+					name = ns:SetNameConfigGroup(MOD.SetGroupFrame, raidToken),
+					buffs = ns:SetAuraConfigGroup(true, "buffs", true, MOD.SetGroupFrame, raidToken),
+					debuffs = ns:SetAuraConfigGroup(true, "debuffs", true, MOD.SetGroupFrame, raidToken),
 					auraWatch = {
 						order = 600,
 						type = "group",
@@ -339,8 +300,8 @@ for w=10,40,15 do
 								type = "toggle",
 								name = L["Enable"],
 								order = 1,
-								get = function(l)return SV.db.SVUnit["raid" .. w].auraWatch.enable end,
-								set = function(l, m)MOD:ChangeDBVar(m, "enable", "raid" .. w, "auraWatch");MOD:SetGroupFrame("raid" .. w)end,
+								get = function(l)return SV.db.SVUnit[raidToken].auraWatch.enable end,
+								set = function(l, m)MOD:ChangeDBVar(m, "enable", raidToken, "auraWatch");MOD:SetGroupFrame(raidToken)end,
 							},
 							size = {
 								type = "range",
@@ -350,8 +311,8 @@ for w=10,40,15 do
 								min = 4,
 								max = 15,
 								step = 1,
-								get = function(l)return SV.db.SVUnit["raid" .. w].auraWatch.size end,
-								set = function(l, m)MOD:ChangeDBVar(m, "size", "raid" .. w, "auraWatch");MOD:SetGroupFrame("raid" .. w)end,
+								get = function(l)return SV.db.SVUnit[raidToken].auraWatch.size end,
+								set = function(l, m)MOD:ChangeDBVar(m, "size", raidToken, "auraWatch");MOD:SetGroupFrame(raidToken)end,
 							},
 							configureButton = {
 								type = "execute",
@@ -367,8 +328,8 @@ for w=10,40,15 do
 						type = "group",
 						name = L["RaidDebuff Indicator"],
 						get = function(l)return
-						SV.db.SVUnit["raid" .. w]["rdebuffs"][l[#l]]end,
-						set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w, "rdebuffs");MOD:SetGroupFrame("raid" .. w)end,
+						SV.db.SVUnit[raidToken]["rdebuffs"][l[#l]]end,
+						set = function(l, m)MOD:ChangeDBVar(m, l[#l], raidToken, "rdebuffs");MOD:SetGroupFrame(raidToken)end,
 						args = {
 							enable = {
 								type = "toggle",
@@ -415,7 +376,7 @@ for w=10,40,15 do
 							},
 						},
 					},
-					icons = ns:SetIconConfigGroup(MOD.SetGroupFrame, "raid" .. w),
+					icons = ns:SetIconConfigGroup(MOD.SetGroupFrame, raidToken),
 				},
 			},
 		},
@@ -423,7 +384,7 @@ for w=10,40,15 do
 end

 subOrder = subOrder + 1
-SV.Options.args.SVUnit.args.raidpet ={
+SV.Options.args.SVUnit.args.raidpet = {
 	order = subOrder,
 	type = 'group',
 	name = L['Raid Pet Frames'],
@@ -431,71 +392,71 @@ SV.Options.args.SVUnit.args.raidpet ={
 	get = function(l)return
 	SV.db.SVUnit['raidpet'][l[#l]]end,
 	set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet')end,
-	args ={
-		enable ={
+	args = {
+		enable = {
 			type = 'toggle',
 			order = 1,
 			name = L['Enable'],
 		},
-		configureToggle ={
+		configureToggle = {
 			order = 2,
 			type = 'execute',
 			name = L['Display Frames'],
 			func = function()MOD:ViewGroupFrames(SVUI_Raidpet, SVUI_Raidpet.forceShow ~= true or nil)end,
 		},
-		resetSettings ={
+		resetSettings = {
 			type = 'execute',
 			order = 3,
 			name = L['Restore Defaults'],
-			func = function(l, m)MOD:ResetUnitOptions('raidpet')SV.Mentalo:Reset('Raid Pet Frames')MOD:SetGroupFrame('raidpet', nil, nil, true)end,
+			func = function(l, m)MOD:ResetUnitOptions('raidpet')SV.Mentalo:Reset('Raid Pet Frames')MOD:SetGroupFrame('raidpet', true)end,
 		},
-		tabGroups={
+		tabGroups= {
 			order=3,
 			type='group',
 			name=L['Unit Options'],
 			childGroups="tree",
-			args={
-				commonGroup={
+			args= {
+				commonGroup= {
 					order=1,
 					type='group',
 					name=L['General Settings'],
-					args={
-						rangeCheck ={
+					args= {
+						rangeCheck = {
 							order = 3,
 							name = L["Range Check"],
 							desc = L["Check if you are in range to cast spells on this specific unit."],
 							type = "toggle",
 						},
-						predict ={
+						predict = {
 							order = 4,
 							name = L['Heal Prediction'],
 							desc = L['Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals.'],
 							type = 'toggle',
 						},
-						threatEnabled ={
+						threatEnabled = {
 							type = 'toggle',
 							order = 5,
 							name = L['Show Threat'],
 						},
-						colorOverride ={
+						colorOverride = {
 							order = 6,
 							name = L['Class Color Override'],
 							desc = L['Override the default class color setting.'],
 							type = 'select',
-							values ={
+							values = {
 								['USE_DEFAULT'] = L['Use Default'],
 								['FORCE_ON'] = L['Force On'],
 								['FORCE_OFF'] = L['Force Off'],
 							},
 						},
-						positionsGroup ={
+						positionsGroup = {
 							order = 100,
 							name = L['Size and Positions'],
 							type = 'group',
 							guiInline = true,
-							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet', nil, nil, true)end,
-							args ={
-								width ={
+							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet', true)end,
+							args = {
+								width = {
 									order = 1,
 									name = L['Width'],
 									type = 'range',
@@ -504,7 +465,7 @@ SV.Options.args.SVUnit.args.raidpet ={
 									step = 1,
 									set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet')end,
 								},
-								height ={
+								height = {
 									order = 2,
 									name = L['Height'],
 									type = 'range',
@@ -513,18 +474,18 @@ SV.Options.args.SVUnit.args.raidpet ={
 									step = 1,
 									set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet')end,
 								},
-								spacer ={
+								spacer = {
 									order = 3,
 									name = '',
 									type = 'description',
 									width = 'full',
 								},
-								showBy ={
+								showBy = {
 									order = 4,
 									name = L['Growth Direction'],
 									desc = L['Growth direction from the first unitframe.'],
 									type = 'select',
-									values ={
+									values = {
 										DOWN_RIGHT = format(L['%s and then %s'], L['Down'], L['Right']),
 										DOWN_LEFT = format(L['%s and then %s'], L['Down'], L['Left']),
 										UP_RIGHT = format(L['%s and then %s'], L['Up'], L['Right']),
@@ -535,18 +496,8 @@ SV.Options.args.SVUnit.args.raidpet ={
 										LEFT_UP = format(L['%s and then %s'], L['Left'], L['Up']),
 									},
 								},
-								groupCount ={
-									order = 7,
-									type = 'range',
-									name = L['Number of Groups'],
-									min = 1,
-									max = 8,
-									step = 1,
-									set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet')if
-									SVUI_Raidpet.isForced then MOD:ViewGroupFrames(SVUI_Raidpet)MOD:ViewGroupFrames(SVUI_Raidpet, true)end end,
-								},
-								gRowCol ={
-									order = 8,
+								gRowCol = {
+									order = 5,
 									type = 'range',
 									name = L['Groups Per Row/Column'],
 									min = 1,
@@ -555,16 +506,16 @@ SV.Options.args.SVUnit.args.raidpet ={
 									set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet')if
 									SVUI_Raidpet.isForced then MOD:ViewGroupFrames(SVUI_Raidpet)MOD:ViewGroupFrames(SVUI_Raidpet, true)end end,
 								},
-								wrapXOffset ={
-									order = 9,
+								wrapXOffset = {
+									order = 6,
 									type = 'range',
 									name = L['Horizontal Spacing'],
 									min = 0,
 									max = 50,
 									step = 1,
 								},
-								wrapYOffset ={
-									order = 10,
+								wrapYOffset = {
+									order = 7,
 									type = 'range',
 									name = L['Vertical Spacing'],
 									min = 0,
@@ -573,14 +524,14 @@ SV.Options.args.SVUnit.args.raidpet ={
 								},
 							},
 						},
-						visibilityGroup ={
+						visibilityGroup = {
 							order = 200,
 							name = L['Visibility'],
 							type = 'group',
 							guiInline = true,
-							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet', nil, nil, true)end,
-							args ={
-								visibility ={
+							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet', true)end,
+							args = {
+								visibility = {
 									order = 2,
 									type = 'input',
 									name = L['Visibility'],
@@ -590,60 +541,47 @@ SV.Options.args.SVUnit.args.raidpet ={
 								},
 							},
 						},
-						sortingGroup ={
+						sortingGroup = {
 							order = 300,
 							type = 'group',
 							guiInline = true,
 							name = L['Grouping & Sorting'],
-							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet', nil, nil, true)end,
-							args ={
-								sortMethod ={
+							set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet");MOD:SetGroupFrame('raidpet', true)end,
+							args = {
+								sortMethod = {
 									order = 1,
 									name = L['Group By'],
 									desc = L['Set the order that the group will sort.'],
 									type = 'select',
-									values ={
+									values = {
 										['NAME'] = L['Owners Name'],
 										['PETNAME'] = L['Pet Name'],
 										['GROUP'] = GROUP,
 									},
 								},
-								sortDir ={
+								sortDir = {
 									order = 2,
 									name = L['Sort Direction'],
 									desc = L['Defines the sort order of the selected sort method.'],
 									type = 'select',
-									values ={
+									values = {
 										['ASC'] = L['Ascending'],
 										['DESC'] = L['Descending'],
 									},
 								},
-								spacer ={
+								spacer = {
 									order = 3,
 									type = 'description',
 									width = 'full',
 									name = ' ',
 								},
-								customSorting ={
+								invertGroupingOrder = {
 									order = 4,
-									name = L['Raid-Wide Sorting'],
-									desc = L['Enabling this allows raid-wide sorting however you will not be able to distinguish between groups.'],
-									type = 'toggle',
-								},
-								invertGroupingOrder ={
-									order = 5,
 									name = L['Invert Grouping Order'],
 									desc = L['Enabling this inverts the grouping order when the raid is not full, this will reverse the direction it starts from.'],
 									disabled = function()return not SV.db.SVUnit['raidpet'].customSorting end,
 									type = 'toggle',
 								},
-								startFromCenter ={
-									order = 6,
-									name = L['Start Near Center'],
-									desc = L['The initial group will start near the center and grow out.'],
-									disabled = function()return not SV.db.SVUnit['raidpet'].customSorting end,
-									type = 'toggle',
-								},
 							},
 						}
 					}
@@ -653,17 +591,17 @@ SV.Options.args.SVUnit.args.raidpet ={
 				name = ns:SetNameConfigGroup(MOD.SetGroupFrame, 'raidpet'),
 				buffs = ns:SetAuraConfigGroup(true, 'buffs', true, MOD.SetGroupFrame, 'raidpet'),
 				debuffs = ns:SetAuraConfigGroup(true, 'debuffs', true, MOD.SetGroupFrame, 'raidpet'),
-				auraWatch ={
+				auraWatch = {
 					order = 600,
 					type = 'group',
 					name = L['Aura Watch'],
-					args ={
+					args = {
 						enable = {
 							type = "toggle",
 							name = L["Enable"],
 							order = 1,
 							get = function(l)return SV.db.SVUnit["raidpet"].auraWatch.enable end,
-							set = function(l, m)MOD:ChangeDBVar(m, "enable", "raidpet", "auraWatch");MOD:SetGroupFrame("raidpet")end,
+							set = function(l, m)MOD:ChangeDBVar(m, "enable", "raidpet", "auraWatch");MOD:SetGroupFrame('raidpet')end,
 						},
 						size = {
 							type = "range",
@@ -674,9 +612,9 @@ SV.Options.args.SVUnit.args.raidpet ={
 							max = 15,
 							step = 1,
 							get = function(l)return SV.db.SVUnit["raidpet"].auraWatch.size end,
-							set = function(l, m)MOD:ChangeDBVar(m, "size", "raidpet", "auraWatch");MOD:SetGroupFrame("raidpet")end,
+							set = function(l, m)MOD:ChangeDBVar(m, "size", "raidpet", "auraWatch");MOD:SetGroupFrame('raidpet')end,
 						},
-						configureButton ={
+						configureButton = {
 							type = 'execute',
 							name = L['Configure Auras'],
 							func = function()ns:SetToFilterConfig('BuffWatch')end,
@@ -684,20 +622,20 @@ SV.Options.args.SVUnit.args.raidpet ={
 						},
 					},
 				},
-				rdebuffs ={
+				rdebuffs = {
 					order = 700,
 					type = 'group',
 					name = L['RaidDebuff Indicator'],
 					get = function(l)return
 					SV.db.SVUnit['raidpet']['rdebuffs'][l[#l]]end,
-					set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet", "rdebuffs");MOD:SetGroupFrame('raidpet')end,
-					args ={
-						enable ={
+					set = function(l, m) MOD:ChangeDBVar(m, l[#l], "raidpet", "rdebuffs"); MOD:SetGroupFrame('raidpet')end,
+					args = {
+						enable = {
 							type = 'toggle',
 							name = L['Enable'],
 							order = 1,
 						},
-						size ={
+						size = {
 							type = 'range',
 							name = L['Size'],
 							order = 2,
@@ -705,7 +643,7 @@ SV.Options.args.SVUnit.args.raidpet ={
 							max = 35,
 							step = 1,
 						},
-						xOffset ={
+						xOffset = {
 							order = 3,
 							type = 'range',
 							name = L['xOffset'],
@@ -713,7 +651,7 @@ SV.Options.args.SVUnit.args.raidpet ={
 							max = 300,
 							step = 1,
 						},
-						yOffset ={
+						yOffset = {
 							order = 4,
 							type = 'range',
 							name = L['yOffset'],
@@ -721,7 +659,7 @@ SV.Options.args.SVUnit.args.raidpet ={
 							max = 300,
 							step = 1,
 						},
-						configureButton ={
+						configureButton = {
 							type = 'execute',
 							name = L['Configure Auras'],
 							func = function()ns:SetToFilterConfig('Raid')end,
diff --git a/Interface/AddOns/SVUI_FightOMatic/SVUI_FightOMatic.lua b/Interface/AddOns/SVUI_FightOMatic/SVUI_FightOMatic.lua
index 5cfcde8..54e871e 100644
--- a/Interface/AddOns/SVUI_FightOMatic/SVUI_FightOMatic.lua
+++ b/Interface/AddOns/SVUI_FightOMatic/SVUI_FightOMatic.lua
@@ -668,9 +668,8 @@ function PLUGIN:EventDistributor(event, ...)
 					if(not EnemyCache[guid]) then
 						local timestamp = time()
 						AddEnemyScan(guid, timestamp)
-					end
-					if(self.cache[guid]) then
-						HeadsUpAlarm("Kill On Sight!", CombatText_StandardScroll, 1, 0, 0, "crit")
+					elseif(self.cache[guid] and self.cache[guid].name) then
+						--HeadsUpAlarm("Kill On Sight!", CombatText_StandardScroll, 1, 0, 0, "crit")
 						if(self.db.annoyingEmotes) then
 							KOS_Emote()
 						end
diff --git a/Interface/AddOns/SVUI_TrackOMatic/SVUI_TrackOMatic.lua b/Interface/AddOns/SVUI_TrackOMatic/SVUI_TrackOMatic.lua
index 78b92c5..b14377c 100644
--- a/Interface/AddOns/SVUI_TrackOMatic/SVUI_TrackOMatic.lua
+++ b/Interface/AddOns/SVUI_TrackOMatic/SVUI_TrackOMatic.lua
@@ -126,35 +126,50 @@ end
 local Tracker_OnUpdate = function(self, elapsed)
     if self.elapsed and self.elapsed > (self.throttle or 0.02) then
         if(self.Trackable) then
-            local distance, angle = self.Track("target", true)
+            local distance, angle = Triangulate("target", true)
             if not angle then
                 self.throttle = 4
                 self.Arrow:SetAlpha(0)
                 self.Radar:SetVertexColor(0.8,0.1,0.1,0.15)
+                -- self.Border:SetVertexColor(1,0,0,0.15)
                 self.BG:SetVertexColor(1,0,0,0.15)
             else
                 self.throttle = 0.02
-                local range = floor(tonumber(distance))
+                local range = floor(distance * 1000)
                 self:Spin(angle)
-                if(range > 100) then
-                    self.Arrow:SetVertexColor(1,0.1,0.1,0.4)
-                    self.Radar:SetVertexColor(0.8,0.1,0.1,0.25)
-                    self.BG:SetVertexColor(0.8,0.4,0.1,0.25)
-                elseif(range > 40) then
-                    self.Arrow:SetVertexColor(1,0.8,0.1,0.6)
-                    self.Radar:SetVertexColor(0.8,0.8,0.1,0.5)
-                    self.BG:SetVertexColor(0.4,0.8,0.1,0.5)
-                elseif(range > 0) then
-                    self.Arrow:SetVertexColor(0.1,1,0.8,0.9)
-                    self.Radar:SetVertexColor(0.1,0.8,0.8,0.75)
-                    self.BG:SetVertexColor(0.1,0.8,0.1,0.75)
+                if(range > 0) then
+                    self.Arrow:SetAlpha(1)
+                    self.Radar:SetAlpha(1)
+                    self.Border:Show()
+                    self.BG:SetAlpha(1)
+                    if(range > 100) then
+                        self.Arrow:SetVertexColor(1,0.1,0.1,0.4)
+                        self.Radar:SetVertexColor(0.8,0.1,0.1,0.25)
+                        -- self.Border:SetVertexColor(0.5,0.2,0.1,0.25)
+                        self.BG:SetVertexColor(0.8,0.4,0.1,0.6)
+                    elseif(range > 40) then
+                        self.Arrow:SetVertexColor(1,0.8,0.1,0.6)
+                        self.Radar:SetVertexColor(0.8,0.8,0.1,0.5)
+                        -- self.Border:SetVertexColor(0.5,0.5,0.1,0.8)
+                        self.BG:SetVertexColor(0.4,0.8,0.1,0.5)
+                    else
+                        self.Arrow:SetVertexColor(0.1,1,0.8,0.9)
+                        self.Radar:SetVertexColor(0.1,0.8,0.8,0.75)
+                        -- self.Border:SetVertexColor(0.1,0.5,0.1,1)
+                        self.BG:SetVertexColor(0.1,0.8,0.1,0.75)
+                    end
+                    self.Range:SetText(range)
                 else
-                    self.Arrow:SetVertexColor(0.1,0.1,0.1,0.1)
-                    self.Radar:SetVertexColor(0.1,0.1,0.1,0.1)
-                    self.BG:SetVertexColor(0.1,0.1,0.1,0.1)
+                    self.Arrow:SetVertexColor(0.1,0.1,0.1,0)
+                    self.Radar:SetVertexColor(0.1,0.1,0.1,0)
+                    -- self.Border:SetVertexColor(0.1,0.1,0.1,0)
+                    self.BG:SetVertexColor(0.1,0.1,0.1,0)
+                    self.Arrow:SetAlpha(0)
+                    self.Radar:SetAlpha(0)
+                    self.Border:Hide()
+                    self.BG:SetAlpha(0)
+                    self.Range:SetText("")
                 end
-                self.Arrow:SetAlpha(1)
-                self.Range:SetText(range)
             end
         else
             self:Hide()
@@ -190,7 +205,6 @@ function PLUGIN:Load()
         _TRACKER.Range:SetFont(SV.Media.font.roboto, 14, "OUTLINE")
         _TRACKER.Range:SetTextColor(1, 1, 1, 0.75)
         _TRACKER.Spin = Rotate_Arrow
-        _TRACKER.Track = _G.Triangulate

         _TRACKER:RegisterForDrag("LeftButton");
         _TRACKER:SetScript("OnUpdate", Tracker_OnUpdate)
diff --git a/Interface/AddOns/SVUI_TrackOMatic/SVUI_TrackOMatic.xml b/Interface/AddOns/SVUI_TrackOMatic/SVUI_TrackOMatic.xml
index ffe98db..51b099b 100644
--- a/Interface/AddOns/SVUI_TrackOMatic/SVUI_TrackOMatic.xml
+++ b/Interface/AddOns/SVUI_TrackOMatic/SVUI_TrackOMatic.xml
@@ -41,6 +41,6 @@
     </Frame>

     <Script file='Loader.lua'/>
-    <Script file='SVUI_TrackOMatic.lua'/>
     <Include file='components\_load.xml'/>
+    <Script file='SVUI_TrackOMatic.lua'/>
 </Ui>
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI_TrackOMatic/components/triangulate.lua b/Interface/AddOns/SVUI_TrackOMatic/components/triangulate.lua
index 60f9f92..576b5f7 100644
--- a/Interface/AddOns/SVUI_TrackOMatic/components/triangulate.lua
+++ b/Interface/AddOns/SVUI_TrackOMatic/components/triangulate.lua
@@ -388,7 +388,7 @@ local function GetDistance(map1, floor1, x1, y1, map2, floor2, x2, y2)
     return dist, angle;
 end

-_G.Triangulate = function(unit, noMapLocation)
+function Triangulate(unit, noMapLocation)
     if(WorldMap and WorldMap:IsShown()) then return end

     local plot1, plot2, plot3, plot4, plot5, plot6, plot7, plot8;