Index: Aura/Aura.lua
===================================================================
--- Aura/Aura.lua	(revision 37806)
+++ Aura/Aura.lua	(working copy)
@@ -1,3 +1,29 @@
+local _G = _G
+local GetTime = _G.GetTime
+local GameTooltip = _G.GameTooltip
+local UnitClass = _G.UnitClass
+local UnitRace = _G.UnitRace
+local UnitBuff = _G.UnitBuff
+local UnitDebuff = _G.UnitDebuff
+local UnitIsUnit = _G.UnitIsUnit
+local UnitIsFriend = _G.UnitIsFriend
+local GetPlayerBuff = _G.GetPlayerBuff
+local GetPlayerBuffName = _G.GetPlayerBuffName
+local GetPlayerBuffTexture = _G.GetPlayerBuffTexture
+local GetPlayerBuffTimeLeft = _G.GetPlayerBuffTimeLeft
+local GetPlayerBuffDispelType = _G.GetPlayerBuffDispelType
+local GetPlayerBuffApplications = _G.GetPlayerBuffApplications
+local math_ceil = _G.math.ceil
+local math_floor = _G.math.floor
+local math_min = _G.math.min
+local table_sort = _G.table.sort
+local unpack = _G.unpack
+local select = _G.select
+local pairs = _G.pairs
+local ipairs = _G.ipairs
+local setmetatable = _G.setmetatable
+local debugstack = _G.debugstack
+
 if select(6, GetAddOnInfo("PitBull_" .. (debugstack():match("[d%.][d%.][O%.]ns\\PitBull\\(.-)\\") or ""))) ~= "MISSING" then return end
 
 local VERSION = tonumber(("$Revision$"):match("%d+"))
@@ -4,14 +30,14 @@
 
 local PitBull = PitBull
 local PitBull_Aura = PitBull:NewModule("Aura", "AceEvent-2.0", "AceConsole-2.0")
-local self = PitBull_Aura
+
 if PitBull.revision < VERSION then
 	PitBull.version = "r" .. VERSION
 	PitBull.revision = VERSION
 	PitBull.date = ("$Date$"):match("%d%d%d%d%-%d%d%-%d%d")
 end
 
-self.desc = "Show buffs and debuffs for PitBull frames as well as highlight frames that need cleansing."
+PitBull_Aura.desc = "Show buffs and debuffs for PitBull frames as well as highlight frames that need cleansing."
 
 local L = PitBull:L("PitBull-Aura")
 local BS = AceLibrary("Babble-Spell-2.2")
@@ -21,21 +47,6 @@
 
 local IsWackyUnit = PitBull.IsWackyUnit
 
-local GetTime = GetTime
-local GameTooltip = GameTooltip
-local UnitBuff = UnitBuff
-local UnitDebuff = UnitDebuff
-local GetPlayerBuff = GetPlayerBuff
-local GetPlayerBuffName = GetPlayerBuffName
-local GetPlayerBuffTexture = GetPlayerBuffTexture
-local GetPlayerBuffDispelType = GetPlayerBuffDispelType
-local GetPlayerBuffApplications = GetPlayerBuffApplications
-local math_floor = math.floor
-local math_min = math.min
-local table_sort = table.sort
-local unpack = unpack
-local select = select
-
 local canDispel, friendBuffs, friendDebuffs, selfBuffs, selfDebuffs, petBuffs, petDebuffs, enemyDebuffs
 local buffFilterTable = {}
 local playerClass, playerRace
@@ -651,7 +662,6 @@
 		enemyDebuffs[BS["War Stomp"]] = true
 	end
 	
-	local buffsIterator
 	for buffsIterator in pairs(friendBuffs) do
 		buffFilterTable[buffsIterator] = buffsIterator
 	end
@@ -669,9 +679,13 @@
 
 local configMode = PitBull.configMode
 
-local border_path = "Interface\\AddOns\\" .. debugstack():match("[d%.][d%.][O%.]ns\\(.-)\\[A-Za-z]-%.lua") .. "\\border"
-local debuffHighlight_path = "Interface\\AddOns\\" .. debugstack():match("[d%.][d%.][O%.]ns\\(.-)\\[A-Za-z]-%.lua") .. "\\debuffHighlight"
-local debuffHighlightBorder_path = "Interface\\AddOns\\" .. debugstack():match("[d%.][d%.][O%.]ns\\(.-)\\[A-Za-z]-%.lua") .. "\\debuffHighlightBorder"
+local border_path, debuffHighlight_path, debuffHighlightBorder_path
+do
+	local path = "Interface\\AddOns\\" .. debugstack():match("[d%.][d%.][O%.]ns\\(.-)\\[A-Za-z]-%.lua")
+	border_path = path .. "\\border"
+	debuffHighlight_path = path .. "\\debuffHighlight"
+	debuffHighlightBorder_path = path .. "\\debuffHighlightBorder"
+end
 
 function PitBull_Aura:OnInitialize()
 	self.db = PitBull:AcquireDBNamespace("Aura")
@@ -730,9 +744,10 @@
 end
 
 function PitBull_Aura:UNIT_AURA(units)
+	local p = self.db.profile
 	for unit in pairs(units) do
 		for frame in PitBull:IterateUnitFramesForUnit(unit) do
-			if unitsShown[frame] and not self.db.profile[frame.group].hidden then
+			if unitsShown[frame] and not p[frame.group].hidden then
 				self:UpdateAuras(unit, frame)
 			end
 		end
@@ -793,6 +808,7 @@
 	if GameTooltip:IsOwned(this) then
 		PitBull_Aura:CancelScheduledEvent("PitBull_Aura-buffFrame-Update")
 		PitBull_Aura:CancelScheduledEvent("PitBull_Aura-debuffFrame-Update")
+		GameTooltip.owner = nil
 		GameTooltip:Hide()
 	end
 end
@@ -800,16 +816,15 @@
 
 local aurasNeedTextUpdate = {}
 
-local math_ceil = math.ceil
-local HOUR_ONELETTER_ABBR = HOUR_ONELETTER_ABBR:gsub(" ", "") -- "%dh"
-local MINUTE_ONELETTER_ABBR = MINUTE_ONELETTER_ABBR:gsub(" ", "") -- "%dm"
+local HOUR_ONELETTER_ABBR = _G.HOUR_ONELETTER_ABBR:gsub(" ", "") -- "%dh"
+local MINUTE_ONELETTER_ABBR = _G.MINUTE_ONELETTER_ABBR:gsub(" ", "") -- "%dm"
 local function formatTime(seconds)
 	if seconds >= 3600 then
 		local hours = math_ceil(seconds/3600)
 		return HOUR_ONELETTER_ABBR:format(hours)
 	elseif seconds >= 180 then
 		local minutes = math_ceil(seconds/60)
-		return MINUTE_ONELETTER_ABBR:format(seconds/60)
+		return MINUTE_ONELETTER_ABBR:format(minutes)
 	elseif seconds > 60 then
 		seconds = math_ceil(seconds)
 		return ("%d:%d"):format(seconds/60, seconds%60)
@@ -952,9 +967,42 @@
 	return a_id < b_id
 end
 
+local function clear_buff_frame(buff)
+		local f = buff.text
+		if f then
+			buff.text = delFrame(f)
+		end
+		f = buff.border
+		if f then
+			buff.border = delFrame(f)
+		end
+		f = buff.cooldownText
+		if f then
+			aurasNeedTextUpdate[buff] = nil
+			buff.cooldownText = delFrame(f)
+		end
+		f = buff.cooldown
+		if f then
+			f.startCooldownTime = nil
+			buff.cooldown = delFrame(f)
+		end
+		buff.icon = delFrame(buff.icon)
+		buff.unit = nil
+		buff.id = nil
+		buff.dispelType = nil
+		buff.name = nil
+		buff.player = nil
+		buff:SetScript("OnEnter", nil)
+		buff:SetScript("OnLeave", nil)
+		if GameTooltip.owner == buff then
+			buffFrame_OnLeave(buff)
+		end
+		delFrame(buff)
+end
+
 local PlayerBuffDurations = setmetatable({}, {__index=function(self,key)
 	for i = 1, 40 do
-		local name, _, texture, applications, duration, timeLeft = UnitBuff("player", i)
+		local name, _, texture, _, duration = UnitBuff("player", i)
 		if not texture then
 			break
 		end
@@ -971,7 +1019,8 @@
 		return
 	end
 
-	local db = PitBull_Aura.db.profile[frame.group]
+	local profile = PitBull_Aura.db.profile
+	local db = profile[frame.group]
 
 	local split = frame.auraFrame2
 	local raidFilter = db.buffFilter
@@ -980,23 +1029,32 @@
 	
 	local buffFilterSelection = db.buffFilterSelection
 	
-	local buffs = auraFrame.buffs or new()
-	local max_buffs_perrow = math_floor(auraFrame:GetWidth() / size)
-	local scale_adjust = auraFrame:GetWidth() / (size * max_buffs_perrow)
+	local buffs = auraFrame.buffs
+	if not buffs then
+		buffs = new()
+		auraFrame.buffs = buffs
+	end
 	local font, fontsize = PitBull:GetFont()
 	
-	if db.snap then
-		size = size * scale_adjust
+	local max_buffs_per_row
+	do
+		local width = auraFrame:GetWidth()
+		max_buffs_per_row = math_floor(width / size)
+		if db.snap then
+			local scale_adjust = width / (size * max_buffs_per_row)
+			size = size * scale_adjust
+		end
 	end
 	
-	local player = UnitIsUnit(unit, "player")
-	local pet = not player and UnitIsUnit(unit, "pet")
-	local isfriend = not pet and UnitIsFriend("player", unit)
+	local isplayer = UnitIsUnit(unit, "player")
+	local ispet = not isplayer and UnitIsUnit(unit, "pet")
+	local isfriend = isplayer or not ispet and UnitIsFriend("player", unit)
+	
 	local list = new()
 	for num = 1, 40 do
 		local name, _, texture, applications, duration, timeLeft
 		local good = true
-		if player then
+		if isplayer then
 			local id = GetPlayerBuff(num, "HELPFUL")
 			if id > 0 then
 				name, texture, applications, timeLeft = GetPlayerBuffName(id), GetPlayerBuffTexture(id), GetPlayerBuffApplications(id), GetPlayerBuffTimeLeft(id)
@@ -1011,22 +1069,16 @@
 					end
 				end
 			end
-		elseif pet then
+		else
 			name, _, texture, applications, duration, timeLeft = UnitBuff(unit, num)
 			if texture and raidFilter then
-				if not (petBuffs[name] and buffFilterSelection[name]) and not (friendBuffs[name] and buffFilterSelection[name]) then
+				if 
+					(ispet and not (petBuffs[name] and buffFilterSelection[name]) and not (friendBuffs[name] and buffFilterSelection[name])) or
+					(isfriend and not (friendBuffs[name] and buffFilterSelection[name]))
+				then
 					good = false
 				end
 			end
-		elseif isfriend then
-			name, _, texture, applications, duration, timeLeft = UnitBuff(unit, num)
-			if texture and raidFilter then
-				if not (friendBuffs[name] and buffFilterSelection[name]) then
-					good = false
-				end
-			end
-		else
-			name, _, texture, applications, duration, timeLeft = UnitBuff(unit, num)
 		end
 		if (texture and good) or configMode then
 			list[#list + 1] = new(num, name, texture, applications, duration, timeLeft)
@@ -1034,7 +1086,7 @@
 	end
 	
 	if db.sort then
-		buffsort_isfriend = player or pet or isfriend
+		buffsort_isfriend = isplayer or ispet or isfriend
 		table_sort(list, buffsort)
 	end
 	
@@ -1042,37 +1094,21 @@
 		list[i] = del(list[i])
 	end
 
-	for j = #buffs, #list+1, -1 do
-		local v = buffs[j]
-		buffs[j] = nil
-		if v.text then
-			v.text = delFrame(v.text)
-		end
-		if v.border then
-			v.border = delFrame(v.border)
-		end
-		if v.cooldownText then
-			aurasNeedTextUpdate[v] = nil
-			v.cooldownText = delFrame(v.cooldownText)
-		end
-		if v.cooldown then
-			v.cooldown.startCooldownTime = nil
-			v.cooldown = delFrame(v.cooldown)
-		end
-		v.icon = delFrame(v.icon)
-		v.unit = nil
-		v.id = nil
-		v.name = nil
-		v.player = nil
-		v:SetScript("OnEnter", nil)
-		v:SetScript("OnLeave", nil)
-		if GameTooltip.owner == v then
-			buffFrame_OnLeave(v)
-		end
-		delFrame(v)
+	for i = #buffs, #list+1, -1 do
+		clear_buff_frame(buffs[i])
+		buffs[i] = nil
 	end
 	
+	local do_buff_highlight = db.highlight.Buffs
+	local buff_highlight_color = profile.colors.buffs
+	local show_cooldown = profile.cooldown
+	local show_cooldown_text = profile.cooldownText
+	local cooldown_text_alpha = profile.cooldownTextAlpha
+	
 	for i, v in ipairs(list) do
+		local num, name, texture, applications, duration, timeLeft = unpack(v)
+		list[i] = del(v)
+		
 		local buffFrame = buffs[i]
 		local text, icon
 		if not buffFrame then
@@ -1088,10 +1124,8 @@
 			icon = buffFrame.icon
 		end
 		
-		local texture = v[3]
 		icon:SetTexture(texture)
 		
-		local applications = v[4]
 		if not applications or applications <= 1 then
 			if text then
 				buffFrame.text = delFrame(text)
@@ -1109,78 +1143,81 @@
 			end
 			text:SetText(applications)
 		end
-		if db.highlight.Buffs or (not texture and configMode) then
+		if do_buff_highlight or (not texture and configMode) then
 			local border = buffFrame.border
 			if not border then
 				border = newFrame("Texture", buffFrame, "BORDER")
 				buffFrame.border = border
 				border:SetTexture(border_path)
-				border:SetVertexColor(unpack(self.db.profile.colors.buffs))
+				border:SetVertexColor(unpack(buff_highlight_color))
 				border:ClearAllPoints()
 				border:SetAllPoints(buffFrame)
 			end
 		else
-			if buffFrame.border then
-				buffFrame.border = delFrame(buffFrame.border)
+			local border = buffFrame.border
+			if border then
+				buffFrame.border = delFrame(border)
 			end
 		end
 
+		local cooldownText = buffFrame.cooldownText
+		local cooldown = buffFrame.cooldown
 		if texture then
 			buffFrame:SetScript("OnEnter", buffFrame_OnEnter)
 			buffFrame:SetScript("OnLeave", buffFrame_OnLeave)
-			buffFrame.id = v[1]
-			buffFrame.player = player
+			buffFrame.id = num
+			buffFrame.player = isplayer
 			buffFrame.unit = unit
-			buffFrame.name = v[2]
+			buffFrame.name = name
 			
-			local duration = v[5]
 			if duration and duration > 0 then
-				if self.db.profile.cooldownText then
-					if not buffFrame.cooldownText then
-						local text = newFrame("FontString", buffFrame, "OVERLAY")
-						buffFrame.cooldownText = text
+				if show_cooldown_text then
+					if not cooldownText then
+						cooldownText = newFrame("FontString", buffFrame, "OVERLAY")
+						buffFrame.cooldownText = cooldownText
 						aurasNeedTextUpdate[buffFrame] = true
-						text:SetAlpha(self.db.profile.cooldownTextAlpha)
-						text:SetFont(font, fontsize * 0.8, "OUTLINE")
-						text:SetShadowColor(0, 0, 0, 1)
-						text:SetShadowOffset(0.8, -0.8)
-						text:ClearAllPoints()
-						text:SetPoint("TOP", buffFrame, "TOP", 0, 0)
+						cooldownText:SetAlpha(cooldown_text_alpha)
+						cooldownText:SetFont(font, fontsize * 0.8, "OUTLINE")
+						cooldownText:SetShadowColor(0, 0, 0, 1)
+						cooldownText:SetShadowOffset(0.8, -0.8)
+						cooldownText:ClearAllPoints()
+						cooldownText:SetPoint("TOP", buffFrame, "TOP", 0, 0)
 					end
-					local timeLeft = v[6]
 					buffFrame.cooldownTimeTillDone = GetTime() + timeLeft
-					buffFrame.cooldownText:SetText(formatTime(timeLeft))
+					cooldownText:SetText(formatTime(timeLeft))
 				else
-					if buffFrame.cooldownText then
+					if cooldownText then
 						aurasNeedTextUpdate[buffFrame] = nil
-						buffFrame.cooldownText = delFrame(buffFrame.cooldownText)
+						buffFrame.cooldownText = delFrame(cooldownText)
+						cooldownText = nil
 					end
 				end
-				if self.db.profile.cooldown then
-					local cooldown = buffFrame.cooldown
+				if show_cooldown then
 					if not cooldown then
 						cooldown = newFrame("Cooldown", buffFrame)
 						cooldown:SetReverse(true)
 						buffFrame.cooldown = cooldown
 						cooldown:SetAllPoints(buffFrame)
 					end
-					local timeLeft = v[6]
 					local startCooldownTime = GetTime() + timeLeft - duration
 					cooldown:SetCooldown(startCooldownTime, duration)
 				else	
-					if buffFrame.cooldown then
-						buffFrame.cooldown.startCooldownTime = nil
-						buffFrame.cooldown = delFrame(buffFrame.cooldown)
+					if cooldown then
+						cooldown.startCooldownTime = nil
+						buffFrame.cooldown = delFrame(cooldown)
+						cooldown = nil
 					end
 				end
 			else
-				if buffFrame.cooldownText then
+				if cooldownText then
 					aurasNeedTextUpdate[buffFrame] = nil
-					buffFrame.cooldownText = delFrame(buffFrame.cooldownText)
+					buffFrame.cooldownText = delFrame(cooldownText)
+					cooldownText = nil
 				end
-				if buffFrame.cooldown then
-					buffFrame.cooldown.startCooldownTime = nil
-					buffFrame.cooldown = delFrame(buffFrame.cooldown)
+				if cooldown then
+					cooldown.startCooldownTime = nil
+					buffFrame.cooldown = delFrame(cooldown)
+					cooldown = nil
 				end
 			end
 		else
@@ -1194,84 +1231,92 @@
 				text:SetPoint("BOTTOMRIGHT", buffFrame, "BOTTOMRIGHT", 0, 0)
 			end
 			text:SetText("X")
-			if buffFrame.cooldownText then
+			if cooldownText then
 				aurasNeedTextUpdate[buffFrame] = nil
-				buffFrame.cooldownText = delFrame(buffFrame.cooldownText)
+				buffFrame.cooldownText = delFrame(cooldownText)
+				cooldownText = nil
 			end
-			if buffFrame.cooldown then
-				buffFrame.cooldown.startCooldownTime = nil
-				buffFrame.cooldown = delFrame(buffFrame.cooldown)
+			if cooldown then
+				cooldown.startCooldownTime = nil
+				buffFrame.cooldown = delFrame(cooldown)
+				cooldown = nil
 			end
 		end
-		if buffFrame.cooldown then
+		if cooldown then
 			if text then
-				text:SetParent(buffFrame.cooldown)
+				text:SetParent(cooldown)
 			end
-			if buffFrame.cooldownText then
-				buffFrame.cooldownText:SetParent(buffFrame.cooldown)
+			if cooldownText then
+				cooldownText:SetParent(cooldown)
 			end
 		else
 			if text then
 				text:SetParent(buffFrame)
 			end
-			if buffFrame.cooldownText then
-				buffFrame.cooldownText:SetParent(buffFrame)
+			if cooldownText then
+				cooldownText:SetParent(buffFrame)
 			end
 		end
-		list[i] = del(v)
 	end
-	list = del(list)
+	del(list)
 	local num_buffs = #buffs
 	
-	local row = 1
 	local lastrow = 1
 	
-	local direction = db.buffdirection
-	for i = 1, num_buffs do
-		local buff = buffs[i]
-		buff:Show()
-		buff:ClearAllPoints()
-		-- Workaround, find and fix invalid sizes.
-		buff:SetWidth(size)
-		buff:SetHeight(size)
-		if split then
-			if direction == "Up then Left" then
-				buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -1 * (row - 1) * size, ((i-1) % max_buffs_perrow) * size)
-			elseif direction == "Up then Right" then
-				buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", (row - 1) * size, ((i-1) % max_buffs_perrow) * size)
-			elseif direction == "Down then Left" then
-				buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -1 * (row - 1) * size, -1 * ((i-1) % max_buffs_perrow) * size)
-			elseif direction == "Down then Right" then
-				buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", (row - 1) * size, -1 * ((i-1) % max_buffs_perrow) * size)
-			elseif direction == "Left then Up" then
-				buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -1 * ((i-1) % max_buffs_perrow) * size, (row - 1) * size)
-			elseif direction == "Left then Down" then
-				buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -1 * ((i-1) % max_buffs_perrow) * size, -1 * (row - 1) * size)
-			elseif direction == "Right then Up" then
-				buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", ((i-1) % max_buffs_perrow) * size, (row - 1) * size)
-			elseif direction == "Right then Down" then
-				buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", ((i-1) % max_buffs_perrow) * size, -1 * (row - 1) * size)
+	if num_buffs == 0 then
+		auraFrame.buffs = del(buffs)
+	else
+		local direction = db.buffdirection
+		local pos_a = 0
+		local pos_b = 0
+		local group_grow = db.grow
+		local group_flip = db.flip
+		
+		for i = 1, num_buffs do
+			local buff = buffs[i]
+			buff:Show()
+			buff:ClearAllPoints()
+			-- Workaround, find and fix invalid sizes.
+			buff:SetWidth(size)
+			buff:SetHeight(size)
+			if split then
+				if direction == "Up then Left" then
+					buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -pos_a, pos_b)
+				elseif direction == "Up then Right" then
+					buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", pos_a, pos_b)
+				elseif direction == "Down then Left" then
+					buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -pos_a, -pos_b)
+				elseif direction == "Down then Right" then
+					buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", pos_a, -pos_b)
+				elseif direction == "Left then Up" then
+					buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -pos_b, pos_a)
+				elseif direction == "Left then Down" then
+					buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -pos_b, -pos_a)
+				elseif direction == "Right then Up" then
+					buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", pos_b, pos_a)
+				elseif direction == "Right then Down" then
+					buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", pos_b, -pos_a)
+				end
+			else
+				if group_flip then
+					buff:SetPoint("TOPRIGHT", auraFrame, "TOPRIGHT", -pos_b, pos_a * group_grow)
+				else
+					buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", pos_b, pos_a * group_grow)
+				end
 			end
-		else
-			if db.flip then
-				buff:SetPoint("TOPRIGHT", auraFrame, "TOPRIGHT", ((i-1) % max_buffs_perrow) * -1 * size, (row - 1) * self.db.profile[frame.group].grow * size)
+			if i ~= num_buffs and i % max_buffs_per_row == 0 then
+				lastrow = lastrow + 1
+				pos_a = pos_a + size
+				pos_b = 0
 			else
-				buff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", ((i-1) % max_buffs_perrow) * size, (row - 1) * self.db.profile[frame.group].grow * size)
+				pos_b = pos_b + size
 			end
 		end
-		lastrow = row
-		if i % max_buffs_perrow == 0 then
-			row = row + 1
-		end
 	end
 	
-	if num_buffs == 0 then
-		buffs = del(buffs)
-	end
 	if not split then
 		auraFrame:SetHeight(lastrow * size)
 	end
-	auraFrame.buffs = buffs
 	auraFrame.num_shown_buffs = num_buffs
 end
 
@@ -1289,41 +1334,45 @@
 end})
 
 local function UpdateDebuffs(unit, frame, buffs)
-	if not frame.auraFrame then
+	local split = frame.auraFrame2
+	local auraFrame = split or frame.auraFrame
+	
+	if not auraFrame then
 		return
 	end
 	
-	local db = PitBull_Aura.db.profile[frame.group]
-	
-	local split = frame.auraFrame2
-	
-	local auraFrame = split and frame.auraFrame2 or frame.auraFrame
+	local profile = PitBull_Aura.db.profile
+	local db = profile[frame.group]
 
 	local snap = db.snap
 	local raidFilter = db.debuffFilter
 	local size = db.debuffsize
+	local maxdebuffs = db.maxdebuffs
 
+	local debuffs = auraFrame.debuffs
+	if not debuffs then
+		debuffs = new()
+		auraFrame.debuffs = debuffs
+	end
+	
 	local auraFrame_width = auraFrame:GetWidth()
-	local max_debuffs_perrow = math_floor(auraFrame_width / size)
-	local scale_adjust = auraFrame_width / (size * max_debuffs_perrow)
+	local max_debuffs_per_row = math_floor(auraFrame_width / size)
+	local scale_adjust = auraFrame_width / (size * max_debuffs_per_row)
 	local font, fontsize = PitBull:GetFont()
 	
 	if snap then
 		size = size * scale_adjust
 	end
 	
-	local debuffs = auraFrame.debuffs or new()
+	local isplayer = UnitIsUnit(unit, "player")
+	local ispet = not isplayer and UnitIsUnit(unit, "pet")
+	local isfriend = isplayer or not ispet and UnitIsFriend("player", unit)
 	
-	local maxdebuffs = db.maxdebuffs
-	
-	local player = UnitIsUnit(unit, "player")
-	local pet = not player and UnitIsUnit(unit, "pet")
-	local isfriend = not pet and UnitIsFriend("player", unit)
 	local list = new()
 	for num = 1, 40 do
 		local name, _, texture, applications, dispelType, duration, timeLeft
 		local good = true
-		if player then
+		if isplayer then
 			local id = GetPlayerBuff(num, "HARMFUL")
 			if id > 0 then
 				name, texture, applications, dispelType, timeLeft = GetPlayerBuffName(id), GetPlayerBuffTexture(id), GetPlayerBuffApplications(id), GetPlayerBuffDispelType(id), GetPlayerBuffTimeLeft(id)
@@ -1338,36 +1387,25 @@
 					end
 				end
 			end
-		elseif pet then
-			name, _, texture, applications, dispelType, duration, timeLeft = UnitDebuff(unit, num)
-			if texture and raidFilter then
-				if not canDispel[dispelType] and not petDebuffs[name] and not friendDebuffs[name] then
-					good = false
-				end
-			end
-		elseif isfriend then
-			name, _, texture, applications, dispelType, duration, timeLeft = UnitDebuff(unit, num)
-			if texture and raidFilter then
-				if not canDispel[dispelType] and not friendDebuffs[name] then
-					good = false
-				end
-			end
 		else
 			name, _, texture, applications, dispelType, duration, timeLeft = UnitDebuff(unit, num)
 			if texture and raidFilter then
-				if not enemyDebuffs[name] then
+				if 
+					(ispet and not canDispel[dispelType] and not petDebuffs[name] and not friendDebuffs[name]) or
+					(isfriend and not canDispel[dispelType] and not friendDebuffs[name])
+				then
 					good = false
 				end
 			end
 		end
-		
+
 		if (texture and good) or configMode then
 			list[#list + 1] = new(num, name, texture, applications, dispelType, duration, timeLeft)
 		end
 	end
 
 	if db.sort then
-		debuffsort_isfriend = player or pet or isfriend
+		debuffsort_isfriend = isplayer or ispet or isfriend
 		table_sort(list, debuffsort)
 	end
 	
@@ -1375,41 +1413,23 @@
 		list[i] = del(list[i])
 	end
 	
-	for j = #debuffs, #list+1, -1 do
-		local v = debuffs[j]
-		debuffs[j] = nil
-		if v.text then
-			v.text = delFrame(v.text)
-		end
-		if v.border then
-			v.border = delFrame(v.border)
-		end
-		if v.cooldownText then
-			aurasNeedTextUpdate[v] = nil
-			v.cooldownText = delFrame(v.cooldownText)
-		end
-		if v.cooldown then
-			v.cooldown.startCooldownTime = nil
-			v.cooldown = delFrame(v.cooldown)
-		end
-		v.icon = delFrame(v.icon)
-		v.unit = nil
-		v.id = nil
-		v.name = nil
-		v.dispelType = nil
-		v.player = nil
-		v:SetScript("OnEnter", nil)
-		v:SetScript("OnLeave", nil)
-		if GameTooltip.owner == v then
-			debuffFrame_OnLeave(v)
-		end
-		delFrame(v)
+	for i = #debuffs, #list+1, -1 do
+		clear_buff_frame(debuffs[i])
+		debuffs[i] = nil
 	end
 	
+	local do_debuff_highlight = db.highlight.Debuffs
+	local do_debuff_highlight_type = db.highlightType
+	local debuff_highlight_colors = PitBull_Aura.db.profile.colors.debuffs
+	local show_cooldown = profile.cooldown
+	local show_cooldown_text = profile.cooldownText
+	local cooldown_text_alpha = profile.cooldownTextAlpha
+
 	for i, v in ipairs(list) do
 		local num, name, texture, applications, dispelType, duration, timeLeft = unpack(v)
 		list[i] = del(v)
-		local debuffFrame, text, icon = debuffs[i]
+		local debuffFrame = debuffs[i]
+		local text, icon
 		if not debuffFrame then
 			debuffFrame = newFrame("Button", auraFrame)
 			debuffs[i] = debuffFrame
@@ -1442,85 +1462,90 @@
 			end
 			text:SetText(applications)
 		end
-		if db.highlight.Debuffs or (configMode and not texture) then
+		if do_debuff_highlight or (not texture and configMode) then
 			local border = debuffFrame.border
 			if not border then
 				border = newFrame("Texture", debuffFrame, "BORDER")
 				debuffFrame.border = border
+				border:SetTexture(border_path)
 				border:ClearAllPoints()
 				border:SetAllPoints(debuffFrame)
-				border:SetTexture(border_path)
 			end
-			if PitBull_Aura.db.profile[frame.group].highlightType then
-				border:SetVertexColor(unpack(self.db.profile.colors.debuffs[dispelType or "nil"]))
+			if do_debuff_highlight_type and dispelType then
+				border:SetVertexColor(unpack(debuff_highlight_colors[dispelType]))
 			else
-				border:SetVertexColor(unpack(self.db.profile.colors.debuffs["nil"]))
+				border:SetVertexColor(unpack(debuff_highlight_colors["nil"]))
 			end
 		else
-			if debuffFrame.border then
-				debuffFrame.border = delFrame(debuffFrame.border)
+			local border = debuffFrame.border
+			if border then
+				debuffFrame.border = delFrame(border)
 			end
 		end
 
+		local cooldownText = debuffFrame.cooldownText
+		local cooldown = debuffFrame.cooldown
 		if texture then
 			debuffFrame:SetScript("OnEnter", debuffFrame_OnEnter)
 			debuffFrame:SetScript("OnLeave", debuffFrame_OnLeave)
 			debuffFrame.id = num
+			debuffFrame.player = isplayer
 			debuffFrame.unit = unit
-			debuffFrame.player = player
-		
+			debuffFrame.name = name
 			debuffFrame.dispelType = dispelType
-			debuffFrame.name = name
 			
 			if duration and duration > 0 then
-				if self.db.profile.cooldownText then
-					if not debuffFrame.cooldownText then
-						local text = newFrame("FontString", debuffFrame, "OVERLAY")
-						debuffFrame.cooldownText = text
+				if show_cooldown_text then
+					if not cooldownText then
+						cooldownText = newFrame("FontString", debuffFrame, "OVERLAY")
+						debuffFrame.cooldownText = cooldownText
 						aurasNeedTextUpdate[debuffFrame] = true
-						text:SetAlpha(self.db.profile.cooldownTextAlpha)
-						text:SetFont(font, fontsize * 0.8, "OUTLINE")
-						text:SetShadowColor(0, 0, 0, 1)
-						text:SetShadowOffset(0.8, -0.8)
-						text:ClearAllPoints()
-						text:SetPoint("TOP", debuffFrame, "TOP", 0, 0)
+						cooldownText:SetAlpha(cooldown_text_alpha)
+						cooldownText:SetFont(font, fontsize * 0.8, "OUTLINE")
+						cooldownText:SetShadowColor(0, 0, 0, 1)
+						cooldownText:SetShadowOffset(0.8, -0.8)
+						cooldownText:ClearAllPoints()
+						cooldownText:SetPoint("TOP", debuffFrame, "TOP", 0, 0)
 					end
 					debuffFrame.cooldownTimeTillDone = GetTime() + timeLeft
-					debuffFrame.cooldownText:SetText(formatTime(timeLeft))
+					cooldownText:SetText(formatTime(timeLeft))
 				else
-					if debuffFrame.cooldownText then
+					if cooldownText then
 						aurasNeedTextUpdate[debuffFrame] = nil
-						debuffFrame.cooldownText = delFrame(debuffFrame.cooldownText)
+						debuffFrame.cooldownText = delFrame(cooldownText)
+						cooldownText = nil
 					end
 				end
-				if self.db.profile.cooldown then
-					local cooldown = debuffFrame.cooldown
+				if show_cooldown then
 					if not cooldown then
 						cooldown = newFrame("Cooldown", debuffFrame)
 						cooldown:SetReverse(true)
 						debuffFrame.cooldown = cooldown
 						cooldown:SetAllPoints(debuffFrame)
 					end
-					local startCooldownTime = GetTime() - duration + timeLeft
+					local startCooldownTime = GetTime() + timeLeft - duration
 					cooldown:SetCooldown(startCooldownTime, duration)
 				else
-					if debuffFrame.cooldown then
-						debuffFrame.cooldown.startCooldownTime = nil
-						debuffFrame.cooldown = delFrame(debuffFrame.cooldown)
+					if cooldown then
+						cooldown.startCooldownTime = nil
+						debuffFrame.cooldown = delFrame(cooldown)
+						cooldown = nil
 					end
 				end
 			else	
-				if debuffFrame.cooldownText then
+				if cooldownText then
 					aurasNeedTextUpdate[debuffFrame] = nil
-					debuffFrame.cooldownText = delFrame(debuffFrame.cooldownText)
+					debuffFrame.cooldownText = delFrame(cooldownText)
+					cooldownText = nil
 				end
-				if debuffFrame.cooldown then
-					debuffFrame.cooldown.startCooldownTime = nil
-					debuffFrame.cooldown = delFrame(debuffFrame.cooldown)
+				if cooldown then
+					cooldown.startCooldownTime = nil
+					debuffFrame.cooldown = delFrame(cooldown)
+					cooldown = nil
 				end
 			end
 		else
-			debuffFrame.name = ''
+			-- debuffFrame.name = ''
 			if not text then
 				text = newFrame("FontString", debuffFrame, "OVERLAY")
 				debuffFrame.text = text
@@ -1531,39 +1556,45 @@
 				text:SetPoint("BOTTOMRIGHT", debuffFrame, "BOTTOMRIGHT", 0, 0)
 			end
 			text:SetText("X")
-			if debuffFrame.cooldownText then
+			if cooldownText then
 				aurasNeedTextUpdate[debuffFrame] = nil
-				debuffFrame.cooldownText = delFrame(debuffFrame.cooldownText)
+				debuffFrame.cooldownText = delFrame(cooldownText)
+				cooldownText = nil
 			end
-			if debuffFrame.cooldown then
-				debuffFrame.cooldown.startCooldownTime = nil
-				debuffFrame.cooldown = delFrame(debuffFrame.cooldown)
+			if cooldown then
+				cooldown.startCooldownTime = nil
+				debuffFrame.cooldown = delFrame(cooldown)
+				cooldown = nil
 			end
 		end
-		if debuffFrame.cooldown then
+		if cooldown then
 			if text then
-				text:SetParent(debuffFrame.cooldown)
+				text:SetParent(cooldown)
 			end
-			if debuffFrame.cooldownText then
-				debuffFrame.cooldownText:SetParent(debuffFrame.cooldown)
+			if cooldownText then
+				cooldownText:SetParent(cooldown)
 			end
 		else
 			if text then
 				text:SetParent(debuffFrame)
 			end
-			if debuffFrame.cooldownText then
-				debuffFrame.cooldownText:SetParent(debuffFrame)
+			if cooldownText then
+				cooldownText:SetParent(debuffFrame)
 			end
 		end
 	end
-	list = del(list)
+	del(list)
 
 	local num_debuffs = #debuffs
 	
-	if split then
+	if num_debuffs == 0 then
+		auraFrame.debuffs = del(debuffs)
+	elseif split then
 		-- note that this is the top row that we"ll be using for the first few debuffs.  split mode they descend, nonsplit they ascend
 		local direction = db.debuffdirection
-		local row = 1
+		local pos_a = 0
+		local pos_b = 0
+
 		for i = 1, num_debuffs do
 			local debuff = debuffs[i]
 			debuff:Show()
@@ -1573,24 +1604,27 @@
 			debuff:SetWidth(size)
 			debuff:SetHeight(size)
 			if direction == "Up then Left" then
-				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -1 * (row - 1) * size, ((i-1) % max_debuffs_perrow) * size)
+				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -pos_a, pos_b)
 			elseif direction == "Up then Right" then
-				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", (row - 1) * size, ((i-1) % max_debuffs_perrow) * size)
+				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", pos_a, pos_b)
 			elseif direction == "Down then Left" then
-				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -1 * (row - 1) * size, -1 * ((i-1) % max_debuffs_perrow) * size)
+				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -pos_a, -pos_b)
 			elseif direction == "Down then Right" then
-				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", (row - 1) * size, -1 * ((i-1) % max_debuffs_perrow) * size)
+				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", pos_a, -pos_b)
 			elseif direction == "Left then Up" then
-				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -1 * ((i-1) % max_debuffs_perrow) * size, (row - 1) * size)
+				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -pos_b, pos_a)
 			elseif direction == "Left then Down" then
-				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -1 * ((i-1) % max_debuffs_perrow) * size, -1 * (row - 1) * size)
+				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", -pos_b, -pos_a)
 			elseif direction == "Right then Up" then
-				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", ((i-1) % max_debuffs_perrow) * size, (row - 1) * size)
+				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", pos_b, pos_a)
 			elseif direction == "Right then Down" then
-				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", ((i-1) % max_debuffs_perrow) * size, -1 * (row - 1) * size)
+				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", pos_b, -pos_a)
 			end
-			if i % max_debuffs_perrow == 0 then
-				row = row + 1
+			if i % max_debuffs_per_row == 0 then
+				pos_a = pos_a + size
+				pos_b = 0
+			else
+				pos_b = pos_b + size
 			end
 		end
 	else
@@ -1600,16 +1634,16 @@
 			buffsize = buffsize * scale_adjust
 		end
 		
-		local max_buffs_perrow = math_floor(auraFrame_width / buffsize)
+		local max_buffs_per_row = math_floor(auraFrame_width / buffsize)
 		local num_buffs = auraFrame.num_shown_buffs or 0
 		
-		local num_buffs_bottomrow = num_buffs % max_buffs_perrow
-		local num_debuffs_toprow = num_debuffs % max_debuffs_perrow
+		local num_buffs_bottomrow = num_buffs % max_buffs_per_row
+		local num_debuffs_toprow = num_debuffs % max_debuffs_per_row
 		
 		local colliding = (num_debuffs_toprow * size + num_buffs_bottomrow * buffsize) > auraFrame_width
 		
 		-- start at the bottom full row of buffs
-		local offset = math_floor(num_buffs / max_buffs_perrow) * buffsize +
+		local offset = math_floor(num_buffs / max_buffs_per_row) * buffsize +
 		-- if colliding, push it down the sum of the values
 		(colliding and (buffsize + size) or 0) +
 		-- if sharing a row, push it down the larger value.
@@ -1619,12 +1653,17 @@
 		((num_debuffs_toprow > 0 and num_buffs_bottomrow == 0) and size or 0)
 		
 		local flip = db.flip
+		flip = (flip and buffs) or (not flip and not buffs)
 		local grow = db.grow
 
 		offset = grow == 1 and offset - buffsize + size or grow * offset
 		
 		-- note that this will be the bottom row that we draw debuffs on.
-		local row = math_floor(num_debuffs / max_debuffs_perrow)
+		local row = math_floor(num_debuffs / max_debuffs_per_row)
+		local pos_b = 0
+		local offset_a = grow * size
+		local pos_a = (row - 1) * offset_a + offset
+		
 		for i = 1, num_debuffs do
 			local debuff = debuffs[i]
 			debuff:Show()
@@ -1633,22 +1672,19 @@
 			-- Workaround, find and fix invalid sizes.
 			debuff:SetWidth(size)
 			debuff:SetHeight(size)
-			if (flip and buffs) or (not flip and not buffs) then
-				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", ((i-1) % max_debuffs_perrow) * size, (row - 1) * grow * size + offset)
+			if flip then
+				debuff:SetPoint("TOPLEFT", auraFrame, "TOPLEFT", pos_b, pos_a)
 			else
-				debuff:SetPoint("TOPRIGHT", auraFrame, "TOPRIGHT", ((i-1) % max_debuffs_perrow) * -1 * size, (row - 1) * grow * size + offset)
+				debuff:SetPoint("TOPRIGHT", auraFrame, "TOPRIGHT", -pos_b, pos_a)
 			end
-			if i % max_debuffs_perrow == 0 then
-				row = row - 1
+			if i % max_debuffs_per_row == 0 then
+				pos_b = 0
+				pos_a = pos_a - offset_a
+			else
+				pos_b = pos_b + size
 			end
 		end
 	end
-	
-	if num_debuffs == 0 then
-		debuffs = del(debuffs)
-	end
-	
-	auraFrame.debuffs = debuffs
 end
 
 local function UpdateFrameHighlight(unit, frame)
@@ -1694,7 +1730,7 @@
 		end
 		frame.debuffhighlight:SetBlendMode("ADD")
 		frame.debuffhighlight:SetAlpha(0.75)
-		local r,g,b = unpack(self.db.profile.colors.debuffs[hashighlight])
+		local r,g,b = unpack(PitBull_Aura.db.profile.colors.debuffs[hashighlight])
 		frame.debuffhighlight:SetVertexColor(r,g,b)
 		frame.debuffhighlight:Show()
 	else
@@ -1704,20 +1740,22 @@
 end
 
 function PitBull_Aura:UpdateAuras(unit, frame)
-	if self.db.profile[frame.group].frameHighlight == "Never" then
+	local db = self.db.profile[frame.group]
+	
+	if db.frameHighlight == "Never" then
 		frame.debuffhighlight:Hide()
 	else
 		UpdateFrameHighlight(unit, frame)
 	end
-	if not unitsShown[frame] or self.db.profile[frame.group].hidden then
+	if not unitsShown[frame] or db.hidden then
 		return
 	end
 	local buffs
-	if not self.db.profile[frame.group].hiddenBuffs then
+	if not db.hiddenBuffs then
 		buffs = true
 		UpdateBuffs(unit, frame)
 	end
-	if not self.db.profile[frame.group].hiddenDebuffs then
+	if not db.hiddenDebuffs then
 		UpdateDebuffs(unit, frame, buffs)
 	end
 end
@@ -1725,7 +1763,7 @@
 do
 	local framedelay = setmetatable({}, {__index = function(t,k)
 		t[k] = 0
-		return t[k]
+		return 0
 	end})
 	function PitBull_Aura:OnUpdateFrame(unit, frame)
 		if not frame.auraFrame or self.db.profile[frame.group].hidden or not unitsShown[frame] then
@@ -1744,19 +1782,19 @@
 end
 
 function PitBull_Aura:OnPopulateUnitFrame(unit, frame)
-	if not self.db.profile[frame.group].hidden then
+	local db = self.db.profile[frame.group]
+	if not db.hidden then
 		frame.auraFrame = newFrame("Frame", frame)
-		if self.db.profile[frame.group].split then
+		if db.split then
 			frame.auraFrame2 = newFrame("Frame", frame)
 		end
 	end
 	local highlight = newFrame("Texture", frame.overlay, "OVERLAY")
 	frame.debuffhighlight = highlight
-	local style = self.db.profile[frame.group].highlightStyle
-	if style == "border" then
-		frame.debuffhighlight:SetTexture(debuffHighlightBorder_path)
+	if db.highlightStyle == "border" then
+		highlight:SetTexture(debuffHighlightBorder_path)
 	else
-		frame.debuffhighlight:SetTexture(debuffHighlight_path)
+		highlight:SetTexture(debuffHighlight_path)
 	end
 	highlight:SetBlendMode("ADD")
 	highlight:SetAlpha(0.75)
@@ -1778,23 +1816,8 @@
 	local buffs = frame.auraFrame.buffs
 	if buffs then
 		for i = 1, #buffs do
-			local v = buffs[i]
+			clear_buff_frame(buffs[i])
 			buffs[i] = nil
-			if v.text then
-				v.text = delFrame(v.text)
-			end
-			v.icon = delFrame(v.icon)
-			if v.border then
-				v.border = delFrame(v.border)
-			end
-			v.unit = nil
-			v.id = nil
-			v:SetScript("OnEnter", nil)
-			v:SetScript("OnLeave", nil)
-			if GameTooltip.owner == v then
-				buffFrame_OnLeave(v)
-			end
-			delFrame(v)
 		end
 		frame.auraFrame.buffs = del(buffs)
 	end
@@ -1807,23 +1830,8 @@
 	end
 	if debuffs then
 		for i = 1, #debuffs do
-			local v = debuffs[i]
+			clear_buff_frame(debuffs[i])
 			debuffs[i] = nil
-			if v.text then
-				v.text = delFrame(v.text)
-			end
-			v.icon = delFrame(v.icon)
-			if v.border then
-				v.border = delFrame(v.border)
-			end
-			v.unit = nil
-			v.id = nil
-			v:SetScript("OnEnter", nil)
-			v:SetScript("OnLeave", nil)
-			if GameTooltip.owner == v then
-				debuffFrame_OnLeave(v)
-			end
-			delFrame(v)
 		end
 		if frame.auraFrame2 then
 			frame.auraFrame2.debuffs = del(debuffs)
@@ -1971,12 +1979,12 @@
 end
 
 local function getHighlightColor(table)
-local type, type2 = table[1], table[2]
+	local group, type, type2 = table[1], table[2], table[3]
 	return unpack(type2 and PitBull_Aura.db.profile.colors[type][type2] or PitBull_Aura.db.profile.colors[type])
 end
 
 local function setHighlightColor(table, r, g, b, a)
-local type, type2 = table[1], table[2]
+	local group, type, type2 = table[1], table[2], table[3]
 	if type2 then
 		PitBull_Aura.db.profile.colors[type][type2] = {r, g, b, a}
 	else
@@ -2297,7 +2305,7 @@
 								hasAlpha = true,
 								get = getHighlightColor,
 								set = setHighlightColor,
-								passValue = {"buffs"},
+								passValue = {group, "buffs"},
 							},
 							Debuffs = {
 								type = "group",
@@ -2311,7 +2319,7 @@
 										hasAlpha = true,
 										get = getHighlightColor,
 										set = setHighlightColor,
-										passValue = {"debuffs", "Curse"},
+										passValue = {group, "debuffs", "Curse"},
 									},
 									Poison = {
 										type = "color",
@@ -2320,7 +2328,7 @@
 										hasAlpha = true,
 										get = getHighlightColor,
 										set = setHighlightColor,
-										passValue = {"debuffs", "Poison"},
+										passValue = {group, "debuffs", "Poison"},
 									},
 									Magic = {
 										type = "color",
@@ -2329,7 +2337,7 @@
 										hasAlpha = true,
 										get = getHighlightColor,
 										set = setHighlightColor,
-										passValue = {"debuffs", "Magic"},
+										passValue = {group, "debuffs", "Magic"},
 									},
 									Disease = {
 										type = "color",
@@ -2338,7 +2346,7 @@
 										hasAlpha = true,
 										get = getHighlightColor,
 										set = setHighlightColor,
-										passValue = {"debuffs", "Disease"},
+										passValue = {group, "debuffs", "Disease"},
 									},
 									Other = {
 										type = "color",
@@ -2347,7 +2355,7 @@
 										hasAlpha = true,
 										get = getHighlightColor,
 										set = setHighlightColor,
-										passValue = {"debuffs", "nil"},
+										passValue = {group, "debuffs", "nil"},
 									},
 								}
 							}
@@ -2534,7 +2542,7 @@
 			set = function(value)
 				PitBull_Aura.db.profile.cooldown = value
 				for unit, frame in PitBull:IterateUnitFrames() do
-					self:UpdateAuras(unit, frame)
+					PitBull_Aura:UpdateAuras(unit, frame)
 				end
 			end,
 		},
@@ -2553,7 +2561,7 @@
 					set = function(value)
 						PitBull_Aura.db.profile.cooldownText = value
 						for unit, frame in PitBull:IterateUnitFrames() do
-							self:UpdateAuras(unit, frame)
+							PitBull_Aura:UpdateAuras(unit, frame)
 						end
 					end,
 				},
@@ -2573,12 +2581,12 @@
 						PitBull_Aura.db.profile.cooldownText = false
 						PitBull_Aura.db.profile.cooldownTextAlpha = value
 						for unit, frame in PitBull:IterateUnitFrames() do
-							self:UpdateAuras(unit, frame)
+							PitBull_Aura:UpdateAuras(unit, frame)
 						end
 						if old then
 							PitBull_Aura.db.profile.cooldownText = true
 							for unit, frame in PitBull:IterateUnitFrames() do
-								self:UpdateAuras(unit, frame)
+								PitBull_Aura:UpdateAuras(unit, frame)
 							end
 						end
 					end,
