Quantcast

Clock, Location, Performance, Repair, Volume, XP : Refactor code for IDE, mostly comments; some code. Changes for Titan color code

urnati [07-07-24 - 20:04]
Clock, Location, Performance, Repair, Volume, XP : Refactor code for IDE, mostly comments; some code. Changes for Titan  color code
Titan : - AutoHide : Fix tooltip error; shows Enabled / Disabled
- Deprecated Titan Child template plugin code removed.
- Refactor Titan code to move color codes to Titan globals.
- Cleanup Titan tool tip code.
- Add debug to Titan startup code.
Filename
Titan/Titan.lua
Titan/TitanAutoHide.lua
Titan/TitanConfig.lua
Titan/TitanGame.lua
Titan/TitanGlobal.lua
Titan/TitanHistory.lua
Titan/TitanLDB.lua
Titan/TitanTemplate.lua
Titan/TitanTemplate.xml
Titan/TitanUtils.lua
Titan/TitanVariables.lua
Titan/_TitanIDE.lua
TitanClassic/TitanGame.lua
TitanClock/TitanClock.lua
TitanGold/TitanGold.lua
TitanLocation/TitanLocation.lua
TitanPerformance/TitanPerformance.lua
TitanRepair/TitanRepair.lua
TitanVolume/TitanVolume.lua
TitanXP/TitanXP.lua
diff --git a/Titan/Titan.lua b/Titan/Titan.lua
index f06a111..f8354b0 100644
--- a/Titan/Titan.lua
+++ b/Titan/Titan.lua
@@ -1,6 +1,6 @@
 ---@diagnostic disable: duplicate-set-field
 --[===[ File
-Contains the basic routines of Titan.
+Contains the basic routines of Titan.
 All the event handler routines, initialization routines, Titan menu routines, and select plugin handler routines.
 --]===]

@@ -191,19 +191,6 @@ function TitanSetPanelFont(fontname, fontsize)
 			if buttonText then
 				buttonText:SetFont(newfont, fontsize);
 			end
-			-- account for plugins with child buttons
-			local childbuttons = { button:GetChildren() };
-			for _, child in ipairs(childbuttons) do
-				if child then
-					local bname = _G[child:GetName()]
-					if bname then
-						local childbuttonText = _G[child:GetName() .. TITAN_PANEL_TEXT];
-						if childbuttonText then
-							childbuttonText:SetFont(newfont, fontsize);
-						end
-					end
-				end
-			end
 		end
 	end
 	TitanPanel_RefreshPanelButtons();
@@ -252,6 +239,12 @@ print("PEW"
 	if Titan__InitializedPEW then
 		-- Currently no additional steps needed
 	else
+		if Titan_Global.debug.titan_startup then
+			local dbg_msg = "PEW:"
+				.. " Init settings"
+			TitanDebug(dbg_msg, "normal")
+		end
+
 		-- Get Profile and Saved Vars
 		TitanVariables_InitTitanSettings();
 		if TitanAllGetVar("Silenced") then
@@ -269,13 +262,29 @@ print("PEW"

 		-- Set the two anchors in their default positions
 		-- until the Titan bars are drawn
+		if Titan_Global.debug.titan_startup then
+			local dbg_msg = "PEW:"
+				.. " Create anchors for other addons"
+			TitanDebug(dbg_msg, "normal")
+		end
 		TitanPanelTopAnchor:ClearAllPoints();
 		TitanPanelTopAnchor:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 0, 0);
 		TitanPanelBottomAnchor:ClearAllPoints();
 		TitanPanelBottomAnchor:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 0, 0);

 		-- Ensure the bars are created before the plugins are registered.
+		if Titan_Global.debug.titan_startup then
+			local dbg_msg = "PEW:"
+				.. " Create frames for Titan bars"
+			TitanDebug(dbg_msg, "normal")
+		end
 		for idx, v in pairs(TitanBarData) do
+			if Titan_Global.debug.titan_startup then
+				local dbg_msg = "..."
+					.. tostring(v.name)
+				TitanDebug(dbg_msg, "normal")
+			end
+
 			TitanPanelButton_CreateBar(idx)
 		end
 		--		Titan_AutoHide_Create_Frames()
@@ -315,19 +324,40 @@ print("PEW"
 		end
 --]]
 		-- Should be safe to register for events that could show / hide Bars
+		if Titan_Global.debug.titan_startup then
+			local dbg_msg = "PEW:"
+				.. " Register for events Titan needs"
+			TitanDebug(dbg_msg, "normal")
+		end
 		RegisterForEvents()
 	end
 	local _ = nil
 	TitanSettings.Player, _, _ = TitanUtils_GetPlayer()
+
 	-- Some addons wait to create their LDB component or a Titan addon could
 	-- create additional buttons as needed.
 	-- So we need to sync their variables and set them up
+	if Titan_Global.debug.titan_startup then
+		local dbg_msg = "PEW:"
+			.. " Register any plugins found"
+		TitanDebug(dbg_msg, "normal")
+	end
 	TitanUtils_RegisterPluginList()

+	if Titan_Global.debug.titan_startup then
+		local dbg_msg = "PEW:"
+			.. " Synch plugin saved vars"
+		TitanDebug(dbg_msg, "normal")
+	end
 	TitanVariables_UseSettings(nil, TITAN_PROFILE_INIT)

 	-- all addons are loaded so update the config (options)
 	-- some could have registered late...
+	if Titan_Global.debug.titan_startup then
+		local dbg_msg = "PEW:"
+			.. " Init config data (right click menu)"
+		TitanDebug(dbg_msg, "normal")
+	end
 	TitanUpdateConfig("init")

 	-- Init panel font
@@ -356,6 +386,11 @@ print("PEW"
 	end

 	-- Also sync LDB object text with their created Titan plugin
+	if Titan_Global.debug.titan_startup then
+		local dbg_msg = "PEW:"
+			.. " Register any LDB (Titan) plugins"
+		TitanDebug(dbg_msg, "normal")
+	end
 	TitanLDBRefreshButton()
 end

@@ -383,7 +418,11 @@ end
 function TitanPanelBarButton:ADDON_LOADED(addon)
 	if addon == TITAN_ID then
 		_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_ENTERING_WORLD")
-		TitanVariables_InitTitanSettings() -- Min table setup to start.
+
+		if Titan_Global.debug.titan_startup then
+			TitanDebug("Titan ADDON_LOADED")
+		end
+	--		TitanVariables_InitTitanSettings() -- Min table setup to start.
 		-- Unregister event - saves a few event calls.
 		self:UnregisterEvent("ADDON_LOADED");
 		self.ADDON_LOADED = nil
@@ -401,6 +440,9 @@ print("PLAYER_ENTERING_WORLD"
 .." "..tostring(arg2)..""
 )
 --]]
+	if Titan_Global.debug.titan_startup then
+		TitanDebug("Titan PLAYER_ENTERING_WORLD pcall setup routine")
+	end
 	call_success, -- needed for pcall
 	ret_val =  -- actual return values
 		pcall(TitanPanel_PlayerEnteringWorld, arg2)
@@ -1254,7 +1296,7 @@ local function CheckBarBounds(self, width)
 end

 ---local Start the grap of a Short Titan bar if Shift and left mouse are held.
----@param self table
+---@param self table
 local function OnMoveStart(self)
 	if IsShiftKeyDown() then
 		if self:IsMovable() then
@@ -1268,7 +1310,7 @@ local function OnMoveStart(self)
 end

 ---local When a Short Titan bar drag is stopped.
----@param self table
+---@param self table
 local function OnMovingStop(self)
 	self:StopMovingOrSizing()
 	self.isMoving = nil
@@ -1313,7 +1355,7 @@ print("wheel"
 	end
 end

----Titan Force all plugins created from LDB addons, visible or not, to be on the right side of the Titan bar.
+---Titan Force all plugins created from LDB addons, visible or not, to be on the right side of the Titan bar.
 --- Any visible plugin will be forced to the right side on the same bar it is currently on.
 function TitanPanelBarButton_ForceLDBLaunchersRight()
 	local plugin = {}
@@ -1345,7 +1387,7 @@ function TitanPanelBarButton_ForceLDBLaunchersRight()
 	end
 end

----local Helper to create the 'anchor' frames used by other addons that need to adjust so Titan can be visible.
+---local Helper to create the 'anchor' frames used by other addons that need to adjust so Titan can be visible.
 ---The anchor frames are adjusted depending on which Titan bars the user selects to show.
 --- - TitanPanelTopAnchor - the frame at the bottom of the top bar(s) shown.
 --- - TitanPanelBottomAnchor - the frame at the top of the bottom bar(s) shown.
@@ -1356,9 +1398,9 @@ local function TitanAnchors()
 	anchor_bot = anchor_bot >= TITAN_WOW_SCREEN_BOT and anchor_bot or TITAN_WOW_SCREEN_BOT

 	local top_point, top_rel_to, top_rel_point, top_x, top_y = TitanPanelTopAnchor:GetPoint(TitanPanelTopAnchor
-	:GetNumPoints())
+		:GetNumPoints())
 	local bot_point, bot_rel_to, bot_rel_point, bot_x, bot_y = TitanPanelBottomAnchor:GetPoint(TitanPanelBottomAnchor
-	:GetNumPoints())
+		:GetNumPoints())
 	top_y = floor(tonumber(top_y) + 0.5)
 	bot_y = floor(tonumber(bot_y) + 0.5)
 	--[[
@@ -1697,8 +1739,8 @@ function TitanPanel_ReOrder(index)
 end

 ---Titan Remove a plugin then show all the shown all user selected plugins on the Titan bar(s).
---- This cancels all timers of name "TitanPanel"..id as a safeguard to destroy any active plugin timers
---- based on a fixed naming convention : TitanPanel..id, eg. "TitanPanelClock" this prevents "rogue"
+--- This cancels all timers of name "TitanPanel"..id as a safeguard to destroy any active plugin timers
+--- based on a fixed naming convention : TitanPanel..id, eg. "TitanPanelClock" this prevents "rogue"
 --- timers being left behind by lack of an OnHide check
 ---@param id string Unique ID of the plugin
 function TitanPanel_RemoveButton(id)
@@ -1748,8 +1790,8 @@ function TitanPanel_RefreshPanelButtons()
 	end
 end

----Titan Justify the plugins on each Titan bar.
---- Used when :
+---Titan Justify the plugins on each Titan bar.
+--- Used when :
 ---- Init / show of a Titan bar
 ----the user changes the 'center' option on a Titan bar
 function TitanPanelButton_Justify()
@@ -1782,7 +1824,7 @@ function TitanPanelButton_Justify()
 		y_offset = TitanBarData[idx].plugin_y_offset
 		x_offset = TitanBarData[idx].plugin_x_offset
 		firstLeftButton = TitanUtils_GetButton(TitanPanelSettings.Buttons
-		[TitanUtils_GetFirstButtonOnBar(bar, TITAN_LEFT)])
+			[TitanUtils_GetFirstButtonOnBar(bar, TITAN_LEFT)])
 		align = TitanBarDataVars[idx].align --TitanPanelGetVar(bar.."_Align")
 		leftWidth = 0;
 		rightWidth = 0;
@@ -1851,7 +1893,7 @@ local function BuildMainMenu(frame)
 	-----------------
 	-- Plugin Categories
 	-- Both arrays are in TitanGlobal
----@diagnostic disable-next-line: param-type-mismatch
+	---@diagnostic disable-next-line: param-type-mismatch
 	for index, id in pairs(L["TITAN_PANEL_MENU_CATEGORIES"]) do
 		info = {};
 		info.notCheckable = true
@@ -2237,11 +2279,11 @@ local function BuildPluginCategoryMenu(frame)
 					if which_bar == nil then
 						-- Plugin not shown
 					else
---						if internal_bar == TitanBarData[frame].name then
---							info.text = info.text .. TitanUtils_GetGreenText(" (" .. which_bar .. ")")
---						else
-							info.text = info.text .. TitanUtils_GetGoldText(" (" .. which_bar .. ")")
---						end
+						--						if internal_bar == TitanBarData[frame].name then
+						--							info.text = info.text .. TitanUtils_GetGreenText(" (" .. which_bar .. ")")
+						--						else
+						info.text = info.text .. TitanUtils_GetGoldText(" (" .. which_bar .. ")")
+						--						end
 					end

 					if plugin.controlVariables then
@@ -2344,7 +2386,7 @@ print("_prep R click"
 	end
 end

----Titan Determine if the given plugin is on any Titan bar.
+---Titan Determine if the given plugin is on any Titan bar.
 ---@param id string Unique ID of the plugin
 ---@return boolean shown True on a Titan bar even if hidden or on auto hide
 function TitanPanel_IsPluginShown(id)
@@ -2355,7 +2397,7 @@ function TitanPanel_IsPluginShown(id)
 	end
 end

----Titan Determine if the given plugin is / would be on right or left of a Titan bar.
+---Titan Determine if the given plugin is / would be on right or left of a Titan bar.
 ---@param id string Unique ID of the plugin
 ---@return string R_L  TITAN_RIGHT("Right") or TITAN_Left("Left")
 function TitanPanel_GetPluginSide(id)
@@ -2366,17 +2408,6 @@ function TitanPanel_GetPluginSide(id)
 	end
 end

---[[
-print("OnMoveStart"
-.." "..tostring(self:GetName())..""
-.." "..tostring(IsShiftKeyDown())..""
-.." "..tostring(IsAltKeyDown())..""
-.."\n"
-.." x "..tostring(format("%0.1f", self:GetLeft()))..""
-.." y "..tostring(format("%0.1f", self:GetTop()))..""
-)
---]]
-
 ---Titan Set the scale, texture (graphic), and transparancy of all the Titan bars based on the user selection.
 ---@param reason string Debug note on where the call initiated
 function TitanPanel_InitPanelBarButton(reason)
@@ -2396,7 +2427,6 @@ end
 -- Routines to handle creation of Titan bars
 --

-
 ---Titan Create a Titan bar that can show plugins.
 ---@param frame_str string Unique ID of the plugin
 function TitanPanelButton_CreateBar(frame_str)
@@ -2411,25 +2441,7 @@ function TitanPanelButton_CreateBar(frame_str)
 	a_bar:SetScript("OnLeave", function(self) TitanPanelBarButton_OnLeave(self) end)
 	a_bar:SetFrameStrata("DIALOG")

-	--	local x, y, w = TitanVariables_GetBarPos(frame_str)
-	--	local tscale = TitanPanelGetVar("Scale")
-	--[[
-print("_Create bar"
-.." "..tostring(bar_data.name)..""
-.."\n "
-.." "..tostring(bar_data.name)..""
-.." "..tostring(bar_data.show.pt)..""
-.." "..tostring(bar_data.show.rel_fr)..""
-.." "..tostring(bar_data.show.rel_pt)..""
-.."\n "
-.." "..tostring(bar_data.name)..""
-.." "..tostring(format("%0.1f", x))..""
-.." "..tostring(format("%0.1f", y))..""
-.." "..tostring(format("%0.1f", w))..""
-)
---]]
 	if bar_data.user_move then
-		--		a_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, y)
 		a_bar:SetMovable(true)
 		a_bar:SetResizable(true)
 		a_bar:EnableMouse(true)
@@ -2437,11 +2449,8 @@ print("_Create bar"
 		a_bar:SetScript("OnDragStart", OnMoveStart)
 		a_bar:SetScript("OnDragStop", OnMovingStop)
 		a_bar:SetScript("OnMouseWheel", OnMouseWheel)
-		--		a_bar:SetSize(w / tscale, TITAN_PANEL_BAR_HEIGHT)
 	else
 		-- Static full width bar
-		--		a_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, y)
-		--		a_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, y - TITAN_PANEL_BAR_HEIGHT)
 	end

 	-- ======
@@ -2457,32 +2466,16 @@ print("_Create bar"

 	-- ======
 	-- Frame for right clicks
-	-- Use one bar to rule them all
-	-- Use the plugin naming scheme
+	-- Use the plugin naming scheme for one frame to rule them all
 	-- 2024 Feb : Change to match plugin right click menu scheme so one routine can be used.
 	local f = CreateFrame("Frame", this_bar .. TITAN_PANEL_CLICK_MENU_SUFFIX, UIParent, "UIDropDownMenuTemplate")
-	--[[
-	local tool_tip = Titan_Panel.plugin.PRE.."Bar"..Titan_Panel.plugin.POST
-	if _G[tool_tip] then
-		-- already created
-	else
-		f = CreateFrame("Frame", tool_tip, UIParent, "UIDropDownMenuTemplate")
-	end
---]]
+
 	-- ======
 	-- Hider for auto hide feature
 	local hide_bar_name = TITAN_PANEL_HIDE_PREFIX .. bar_data.name
 	if bar_data.hider then
-	--[[
-print("_Create hide bar"
-.." "..tostring(bar_data.name)..""
-.." "..tostring(hide_bar_name)..""
-)
---]]
-
 		local hide_bar = CreateFrame("Button", hide_bar_name, UIParent, "TitanPanelBarButtonHiderTemplate")
 		hide_bar:SetFrameStrata("DIALOG")
-		--		hide_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, -y)

 		-- Set script handlers for display
 		hide_bar:RegisterForClicks("LeftButtonUp", "RightButtonUp");
@@ -2493,7 +2486,7 @@ print("_Create hide bar"
 		hide_bar:SetFrameStrata("BACKGROUND")
 		hide_bar:SetSize(screen.x, TITAN_PANEL_BAR_HEIGHT)
 	else
-		-- Not allowed for this bar
+		-- Hider not allowed for this bar
 	end
 end

diff --git a/Titan/TitanAutoHide.lua b/Titan/TitanAutoHide.lua
index a02241b..afe6341 100644
--- a/Titan/TitanAutoHide.lua
+++ b/Titan/TitanAutoHide.lua
@@ -25,105 +25,31 @@ OUT: None
 --]]
 local function Titan_AutoHide_SetIcon(self)
 	local frame_auto_hide = self:GetName()
-	local bar = self.bar_name
-	local frame_str  = TitanVariables_GetFrameName(bar)
+	local icon = _G[frame_auto_hide.."Icon"]
+	local short = self.registry.short_name
+	local bar = TitanVariables_GetFrameName(short)

 	-- Get the icon of the icon template
-	local icon = _G[frame_auto_hide.."Icon"]
-	if TitanBarDataVars[frame_str].auto_hide then
+	if TitanBarDataVars[bar].auto_hide then
 		icon:SetTexture("Interface\\AddOns\\Titan\\Artwork\\TitanPanelPushpinOut")
 	else
 		icon:SetTexture("Interface\\AddOns\\Titan\\Artwork\\TitanPanelPushpinIn")
 	end
 end

--- Event handlers
---[[
-NAME: Titan_AutoHide_OnLoad
-DESC: Setup the plugin on the given bar.
-VAR: self - The bar
-OUT: None
---]]
-function Titan_AutoHide_OnLoad(self)
-	local frame = self:GetName()
-	local bar = self.bar_name
-
-	self.registry = {
-		id = "AutoHide_"..bar,
-		category = "Built-ins",
-		version = TITAN_VERSION,
-		menuText = "AutoHide_"..bar,
-		tooltipTitle = L["TITAN_PANEL_AUTOHIDE_TOOLTIP"],
-		tooltipTextFunction = "TitanPanelClockButton_GetTooltipText",
-		savedVariables = {
-			DisplayOnRightSide = 1,
-			ForceBar = bar,
-		}
-	};
-end
-
-function TitanPanelClockButton_GetTooltipText(self)
+local function GetTooltipText(self)
 	local returnstring = ""
---[[
-	local bar = self.bar_name
-	local frame_str  = TitanVariables_GetFrameName(bar)
-
-	if TitanBarDataVars[frame_str].auto_hide then
-		returnstring = L["TITAN_PANEL_MENU_DISABLED"]
+	if self.registry.titan_bar then
+		if TitanBarDataVars[self.registry.titan_bar].auto_hide then
+			returnstring = L["TITAN_PANEL_MENU_ENABLED"]
+		else
+			returnstring = L["TITAN_PANEL_MENU_DISABLED"]
+		end
 	else
-		returnstring = L["TITAN_PANEL_MENU_ENABLED"]
+		-- do nothing
 	end
---]]
-	return returnstring
-end

---[[
-NAME: Titan_AutoHide_OnShow
-DESC: Show the plugin on the given bar.
-VAR: self - The bar
-OUT: None
---]]
-function Titan_AutoHide_OnShow(self)
-	Titan_AutoHide_SetIcon(self)
-end
-
---[[
-NAME: Titan_AutoHide_OnClick
-DESC: Handle button clicks on the given bar.
-VAR: self - The bar
-VAR: button - The mouse button clicked
-OUT:  None
---]]
-function Titan_AutoHide_OnClick(self, button)
-	if (button == "LeftButton") then
-		Titan_AutoHide_ToggleAutoHide(self.bar_name);
-	end
-end
-
--- Auto hide routines
---[[
-NAME: Titan_AutoHide_Timers
-DESC: This routine accepts the display bar frame and whether the cursor is entering or leaving. On enter kill the timers that are looking to hide the bar. On leave start the timer to hide the bar.
-VAR: frame - The bar
-VAR: action - "Enter" | "Leave"
-OUT:  None
---]]
-function Titan_AutoHide_Timers(frame, action)
-	if not frame or not action then
-		return
-	end
-	local bar = TitanBarData[frame].name --(frame.bar_name or nil)
-	local hide = TitanBarDataVars[frame].auto_hide -- (bar and TitanPanelGetVar(bar.."_Hide") or nil)
-
-	if bar and hide then
-		if (action == "Enter") then
-				AceTimer.CancelAllTimers(frame)
-		end
-		if (action == "Leave") then
-			-- pass the bar as an arg so we can get it back
-			AceTimer.ScheduleRepeatingTimer(frame, Handle_OnUpdateAutoHide, 0.5, frame)
-		end
-	end
+	return returnstring
 end

 --[[
@@ -168,12 +94,62 @@ function Titan_AutoHide_ToggleAutoHide(bar)
 	local frame_str  = TitanVariables_GetFrameName(bar)

 	-- toggle the correct auto hide variable
-	TitanBarDataVars[frame_str].auto_hide =
-		not TitanBarDataVars[frame_str].auto_hide --TitanPanelToggleVar(bar.."_Hide")
+	TitanBarDataVars[frame_str].auto_hide = not TitanBarDataVars[frame_str].auto_hide
 	-- Hide / show the requested Titan bar
 	Titan_AutoHide_Init(frame_str)
 end

+-- Event handlers
+--[[
+NAME: Titan_AutoHide_OnLoad
+DESC: Setup the plugin on the given bar.
+VAR: self - The bar
+OUT: None
+--]]
+local function Titan_AutoHide_OnLoad(self)
+	local frame = self:GetName()
+	local bar = self.short_name
+
+	self.registry = {
+		id = "AutoHide_"..bar,
+		category = "Built-ins",
+		version = TITAN_VERSION,
+		menuText = "AutoHide_"..bar,
+		tooltipTitle = L["TITAN_PANEL_AUTOHIDE_TOOLTIP"],
+		tooltipTextFunction = GetTooltipText,
+		savedVariables = {
+			DisplayOnRightSide = 1,
+			ForceBar = bar,
+		},
+		-- Based on ForceBar, pass the Titan bar to the tooltip routine
+		short_name = bar,
+		titan_bar = TitanVariables_GetFrameName(bar)
+	};
+end
+
+--[[
+NAME: Titan_AutoHide_OnShow
+DESC: Show the plugin on the given bar.
+VAR: self - The bar
+OUT: None
+--]]
+local function Titan_AutoHide_OnShow(self)
+	Titan_AutoHide_SetIcon(self)
+end
+
+--[[
+NAME: Titan_AutoHide_OnClick
+DESC: Handle button clicks on the given bar.
+VAR: self - The bar
+VAR: button - The mouse button clicked
+OUT:  None
+--]]
+local function Titan_AutoHide_OnClick(self, button)
+	if (button == "LeftButton") then
+		Titan_AutoHide_ToggleAutoHide(self.bar_name);
+	end
+end
+
 --[[
 NAME: Handle_OnUpdateAutoHide
 DESC: Hide the bar if the user has auto hide after the cursor leaves the display bar.
@@ -201,6 +177,32 @@ function Handle_OnUpdateAutoHide(frame)
 	end
 end

+-- Auto hide routines
+--[[
+NAME: Titan_AutoHide_Timers
+DESC: This routine accepts the display bar frame and whether the cursor is entering or leaving. On enter kill the timers that are looking to hide the bar. On leave start the timer to hide the bar.
+VAR: frame - The bar
+VAR: action - "Enter" | "Leave"
+OUT:  None
+--]]
+function Titan_AutoHide_Timers(frame, action)
+	if not frame or not action then
+		return
+	end
+	local bar = TitanBarData[frame].name --(frame.bar_name or nil)
+	local hide = TitanBarDataVars[frame].auto_hide -- (bar and TitanPanelGetVar(bar.."_Hide") or nil)
+
+	if bar and hide then
+		if (action == "Enter") then
+				AceTimer.CancelAllTimers(frame)
+		end
+		if (action == "Leave") then
+			-- pass the bar as an arg so we can get it back
+			AceTimer.ScheduleRepeatingTimer(frame, Handle_OnUpdateAutoHide, 0.5, frame)
+		end
+	end
+end
+
 --
 --==========================
 -- Routines to handle moving and sizing of short bars
@@ -210,7 +212,7 @@ local function Create_Hide_Button(bar, f)
 	local plugin = CreateFrame("Button", name, f, "TitanPanelIconTemplate")
 	plugin:SetFrameStrata("FULLSCREEN")

-	plugin.bar_name = bar -- set the bar name for the .registry
+	plugin.short_name = bar -- set the short bar name for the .registry

 	-- Using SetScript("OnLoad",   does not work
 	Titan_AutoHide_OnLoad(plugin);
@@ -226,7 +228,7 @@ local function Create_Hide_Button(bar, f)
 end

 --local function Create_Frames()
-function Titan_AutoHide_Create_Frames()
+local function Titan_AutoHide_Create_Frames()
 	--====== Titan Auto hide plugin buttons ==============================
 	-- general container frame
 	local f = CreateFrame("Frame", nil, UIParent)
@@ -238,5 +240,4 @@ function Titan_AutoHide_Create_Frames()

 end

-
 Titan_AutoHide_Create_Frames() -- do the work
diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua
index 30894f0..97bb610 100644
--- a/Titan/TitanConfig.lua
+++ b/Titan/TitanConfig.lua
@@ -252,7 +252,7 @@ local titan_entry = {
 				confversiondesc = {
 					order = 1,
 					type = "description",
-					name = "".. Titan_Global.config_notes,
+					name = "" .. Titan_Global.config_notes,
 					cmdHidden = true
 				},
 			}
@@ -285,52 +285,52 @@ local titan_entry = {
 				confversiondesc = {
 					order = 1,
 					type = "description",
-					name = "|cffffd700" .. L["TITAN_PANEL_ABOUT_VERSION"] .. ": "
-						.. _G["GREEN_FONT_COLOR_CODE"] .. TitanPanel_GetVersion(),
+					name = TitanUtils_GetGoldText(L["TITAN_PANEL_ABOUT_VERSION"] .. ": ")
+						.. TitanUtils_GetGreenText(TitanPanel_GetVersion()),
 					cmdHidden = true
 				},
 				confauthordesc = {
 					order = 2,
 					type = "description",
-					name = "|cffffd700" .. L["TITAN_PANEL_ABOUT_AUTHOR"] .. ": "
-						.. "|cffff8c00" .. TitanPanel_GetAuthor(),
+					name = TitanUtils_GetGoldText(L["TITAN_PANEL_ABOUT_AUTHOR"] .. ": ")
+						.. TitanUtils_GetGreenText(TitanPanel_GetAuthor()),
 					cmdHidden = true
 				},
 				confcreditsdesc = {
 					order = 3,
 					type = "description",
-					name = "|cffffd700" .. L["TITAN_PANEL_ABOUT_CREDITS"] .. ": "
-						.. _G["HIGHLIGHT_FONT_COLOR_CODE"] .. TitanPanel_GetCredits(),
+					name = TitanUtils_GetGoldText(L["TITAN_PANEL_ABOUT_CREDITS"] .. ": ")
+						.. TitanUtils_GetGreenText(TitanPanel_GetCredits()),
 					cmdHidden = true
 				},
 				confcatdesc = {
 					order = 4,
 					type = "description",
-					name = "|cffffd700" .. L["TITAN_PANEL_ABOUT_CATEGORY"] .. ": "
-						.. _G["HIGHLIGHT_FONT_COLOR_CODE"] .. TitanPanel_GetCategory(),
+					name = TitanUtils_GetGoldText(L["TITAN_PANEL_ABOUT_CATEGORY"] .. ": ")
+						.. TitanUtils_GetGreenText(TitanPanel_GetCategory()),
 					cmdHidden = true
 				},
 				confemaildesc = {
 					order = 5,
 					type = "description",
-					name = "|cffffd700" .. L["TITAN_PANEL_ABOUT_EMAIL"] .. ": "
-						.. _G["HIGHLIGHT_FONT_COLOR_CODE"] .. TitanPanel_GetEmail(),
+					name = TitanUtils_GetGoldText(L["TITAN_PANEL_ABOUT_EMAIL"] .. ": ")
+						.. TitanUtils_GetGreenText(TitanPanel_GetEmail()),
 					cmdHidden = true
 				},
 				--[[ has not been updated in quite a while...
 				confwebsitedesc = {
 					order = 6,
 					type = "description",
-					name = "|cffffd700"..L["TITAN_PANEL_ABOUT_WEB"]..": "
-						.._G["HIGHLIGHT_FONT_COLOR_CODE"]..TitanPanel_GetWebsite(),
+					name = TitanUtils_GetGoldText(L["TITAN_PANEL_ABOUT_WEB"]..": ")
+						..TitanUtils_GetGreenText(TitanPanel_GetWebsite()),
 					cmdHidden = true
 				},
 --]]
 				conflicensedesc = {
 					order = 7,
 					type = "description",
-					name = "|cffffd700" .. L["TITAN_PANEL_ABOUT_LICENSE"] .. ": "
-						.. _G["HIGHLIGHT_FONT_COLOR_CODE"] .. TitanPanel_GetLicense(),
+					name = TitanUtils_GetGoldText(L["TITAN_PANEL_ABOUT_LICENSE"] .. ": ")
+						.. TitanUtils_GetGreenText(TitanPanel_GetLicense()),
 					cmdHidden = true
 				},
 			}
@@ -366,7 +366,7 @@ local function ColorAdjShown(frame_str)
 	if TitanAdjustSettings[frame_str].adjust then
 		res = frame_str -- leave as is
 	else
-		res = "|cff808080" .. frame_str .. _G["FONT_COLOR_CODE_CLOSE"]
+		res = TitanUtils_GetGrayText(frame_str)
 	end

 	return res
@@ -418,10 +418,10 @@ local function TitanUpdateAdj(t, pos)
 			order = position,
 			width = "full",
 		}
-		position = position + 1  -- Show toggle
+		position = position + 1 -- Show toggle
 		args[f_name].args.show = {
 			type = "toggle",
-			width = .75,         --"fill",
+			width = .75, --"fill",
 			name = USE or "Use", --L["TITAN_PANEL_MENU_DISPLAY_BAR"],
 			order = position,
 			get = function(info)
@@ -517,7 +517,7 @@ local function ColorShown(bar)
 	if TitanBarDataVars[frame_str].show then
 		-- leave as is
 	else
-		res = "|cff808080" .. res .. _G["FONT_COLOR_CODE_CLOSE"]
+		res = TitanUtils_GetGrayText(res)
 	end

 	return res
@@ -568,10 +568,10 @@ local function TitanUpdateConfigBars(t, pos)
 			order = position,
 			width = "full",
 		}
-		position = position + 1  -- Show toggle
+		position = position + 1 -- Show toggle
 		args[v.name].args.show = {
 			type = "toggle",
-			width = .75,         --"fill",
+			width = .75, --"fill",
 			name = L["TITAN_PANEL_MENU_DISPLAY_BAR"],
 			order = position,
 			get = function(info)
@@ -585,10 +585,10 @@ local function TitanUpdateConfigBars(t, pos)
 				TitanUpdateConfigBars(optionsBars.args, 1000)
 			end,
 		}
-		position = position + 1  -- Auto hide toggle
+		position = position + 1 -- Auto hide toggle
 		args[v.name].args.autohide = {
 			type = "toggle",
-			width = .75,         --"fill",
+			width = .75, --"fill",
 			name = L["TITAN_PANEL_MENU_AUTOHIDE"],
 			order = position,
 			disabled = (v.hider == nil),
@@ -600,10 +600,10 @@ local function TitanUpdateConfigBars(t, pos)
 				Titan_AutoHide_ToggleAutoHide(info[1]) -- short bar name
 			end,
 		}
-		position = position + 1  -- Center toggle
+		position = position + 1 -- Center toggle
 		args[v.name].args.center = {
 			type = "toggle",
-			width = .75,         --"fill",
+			width = .75, --"fill",
 			name = L["TITAN_PANEL_MENU_CENTER_TEXT"],
 			order = position,
 			get = function(info)
@@ -622,10 +622,10 @@ local function TitanUpdateConfigBars(t, pos)
 				TitanPanelButton_Justify();
 			end,
 		}
-		position = position + 1  -- Combat hide toggle
+		position = position + 1 -- Combat hide toggle
 		args[v.name].args.hideincombat = {
 			type = "toggle",
-			width = .75,         --"fill",
+			width = .75, --"fill",
 			name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"],
 			order = position,
 			get = function(info)
@@ -675,8 +675,8 @@ local function TitanUpdateConfigBars(t, pos)
 		}
 		position = position + 1 -- select background
 		args[v.name].args.settextousebar = {
-			name = "",     --L["TITAN_PANEL_MENU_GLOBAL_SKIN"],
-			desc = "",     --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TIP"],
+			name = "",    --L["TITAN_PANEL_MENU_GLOBAL_SKIN"],
+			desc = "",    --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TIP"],
 			order = position,
 			type = "select",
 			width = "full",
@@ -726,9 +726,9 @@ local function TitanUpdateConfigBars(t, pos)
 				for _, val in pairs(TitanSkins) do
 					if val.path ~= TitanBarDataVars[frame_str].skin.path then
 						--						if val.path ~= TitanPanelGetVar("Texture"..v.name) then
-						Skinlist[val.path] = "|cff19ff19" .. val.name .. "|r"
+						Skinlist[val.path] = TitanUtils_GetHexText(val.name, Titan_Global.colors.green)
 					else
-						Skinlist[val.path] = "|cffffff9a" .. val.name .. "|r"
+						Skinlist[val.path] = TitanUtils_GetHexText(val.name, Titan_Global.colors.yellow)
 					end
 				end
 				table.sort(Skinlist, function(a, b)
@@ -761,9 +761,9 @@ local function TitanUpdateConfigBars(t, pos)
 			imageWidth = 256,
 			order = position,
 			type = "description",
-			width = .5,                                 --"60",
+			width = .5,   --"60",
 		}
-		position = position + 1                         -- transparency
+		position = position + 1 -- transparency
 		args[v.name].args.trans = {
 			type = "range",
 			width = "full",
@@ -900,9 +900,9 @@ local optionsGlobals = {
 				local v;
 				for _, v in pairs(TitanSkins) do
 					if v.path ~= TitanBarDataVars["Global"].skin.path then --TitanPanelGetVar("TexturePath") then
-						Skinlist[v.path] = "|cff19ff19" .. v.name .. "|r"
+						Skinlist[v.path] = TitanUtils_GetHexText(v.name, Titan_Global.colors.green)
 					else
-						Skinlist[v.path] = "|cffffff9a" .. v.name .. "|r"
+						Skinlist[v.path] = TitanUtils_GetHexText(v.name, Titan_Global.colors.yellow)
 					end
 				end
 				table.sort(Skinlist, function(a, b)
@@ -1092,7 +1092,7 @@ local function ColorVisible(id, name)
 	if TitanPanel_IsPluginShown(id) then
 		res = (name or "")
 	else
-		res = "|cff808080" .. name .. _G["FONT_COLOR_CODE_CLOSE"]
+		res = TitanUtils_GetGrayText(name)
 	end

 	return res
@@ -1302,7 +1302,7 @@ local function TitanUpdateConfigAddons()
 					order = 54,
 					type = "description",
 					name = TitanUtils_GetGoldText(L["TITAN_PANEL_MENU_BAR_ALWAYS"] ..
-					" " .. TitanGetVar(plug_in.id, "ForceBar")),
+						" " .. TitanGetVar(plug_in.id, "ForceBar")),
 					cmdHidden = true,
 				}
 			end
@@ -1339,10 +1339,10 @@ local function TitanUpdateConfigAddons()
 				plug_ldb = ""
 			end
 			local str = ""
-				..plug_version
-				..plug_category
+				.. plug_version
+				.. plug_category
 				.. _G["GREEN_FONT_COLOR_CODE"] .. plug_ldb .. "|r"
-				.."\n"
+				.. "\n"
 				.. plug_notes
 			if plug_in.notes then
 				args[plug_in.id].args.notes = {
@@ -1560,7 +1560,7 @@ local function TitanUpdateChars()
 		type = "description",
 		width = "full",
 		name = L["TITAN_PANEL_GLOBAL_PROFILE"] ..
-		": " .. TitanUtils_GetGoldText(TitanAllGetVar("GlobalProfileName") or "?"),
+			": " .. TitanUtils_GetGoldText(TitanAllGetVar("GlobalProfileName") or "?"),
 	}
 	args["sp_20"] = {
 		type = "description",
@@ -2144,15 +2144,15 @@ local function Show_Skins(t, position)
 	t[skin .. position] = {
 		type = "description",
 		name = ""
-		.. L["TITAN_PANEL_MENU_SKIN_CHANGE"].. "\n"
-		.. "- "..L["TITAN_PANEL_MENU_OPTIONS_BARS"].. "\n"
-		.. "- "..L["TITAN_PANEL_MENU_OPTIONS_BARS_ALL"].. "\n"
-		.. "",
-	cmdHidden = true,
+			.. L["TITAN_PANEL_MENU_SKIN_CHANGE"] .. "\n"
+			.. "- " .. L["TITAN_PANEL_MENU_OPTIONS_BARS"] .. "\n"
+			.. "- " .. L["TITAN_PANEL_MENU_OPTIONS_BARS_ALL"] .. "\n"
+			.. "",
+		cmdHidden = true,
 		order = position,
-		}
+	}

-		for idx, v in pairs(TitanSkins) do
+	for idx, v in pairs(TitanSkins) do
 		position = position + 1 -- spacer
 		t[skin .. position] = {
 			type = "header",
@@ -2164,7 +2164,7 @@ local function Show_Skins(t, position)
 		position = position + 1 -- Name of skin (col 1)
 		t[skin .. position] = {
 			type = "description",
-			name = "|cff19ff19" .. v.name .. "|r",
+			name = TitanUtils_GetHexText(v.name, Titan_Global.colors.green),
 			order = position,
 			width = "30",
 		}
@@ -2362,16 +2362,16 @@ local optionsSkinsCustom = {
 						and v.path ~= "Interface\\AddOns\\Titan\\Artwork\\"
 						and v.titan ~= true
 					then
-						Skinlist[v.path] = "|cff19ff19" .. v.name .. "|r"
+						Skinlist[v.path] = TitanUtils_GetHexText(v.name, Titan_Global.colors.green)
 					end
 					if v.path == TitanSkinToRemove then
-						Skinlist[v.path] = "|cffffff9a" .. v.name .. "|r"
+						Skinlist[v.path] = TitanUtils_GetHexText(v.name, Titan_Global.colors.yellow)
 					end
 				end
 				if TitanSkinToRemove ~= "None" then
-					Skinlist["None"] = "|cff19ff19" .. L["TITAN_PANEL_NONE"] .. "|r"
+					Skinlist["None"] = TitanUtils_GetHexText(L["TITAN_PANEL_NONE"], Titan_Global.colors.green)
 				else
-					Skinlist["None"] = "|cffffff9a" .. L["TITAN_PANEL_NONE"] .. "|r"
+					Skinlist["None"] = TitanUtils_GetHexText(L["TITAN_PANEL_NONE"], Titan_Global.colors.yellow)
 				end
 				table.sort(Skinlist, function(a, b)
 					return string.lower(TitanSkins[a].name)
@@ -2524,7 +2524,7 @@ VAR:  None
 OUT:  None
 NOTE:
 - This is called after the plugins are registered in the 'player entering world' event. It can be called again as plugins registered.
-- Any plugins that attempted to register (no child frames though) are shown. See the Titan Utils section for more details on plugin registration.
+- Any plugins that attempted to register are shown. See the Titan Utils section for more details on plugin registration.
 - This option page is for display only. The user can take not action.
 :NOTE
 --]]
@@ -2553,80 +2553,72 @@ local function TitanUpdateAddonAttempts()
 			local ptype = TitanPluginToBeRegistered[idx].plugin_type
 			local btype = TitanPanelButton_GetType(idx)
 			local title = TitanPluginToBeRegistered[idx].name
-			local isChild = TitanPluginToBeRegistered[idx].isChild and true or false
 			if reason ~= TITAN_REGISTERED then
 				title = TitanUtils_GetRedText(title)
 				issue = TitanUtils_GetRedText(issue)
 			end

-			if isChild then
-				-- Do not show. A child is part of (within) another plugin
-				-- showing it here would be confusing to the 'normal' user.
-				-- A plugin in author would know to look at the
-				-- TitanPluginToBeRegistered array directly.
-			else
-				args[num] = {
-					type = "group",
-					name = title,
-					order = idx,
-					args = {
-						name = {
-							type = "description",
-							name = TitanUtils_GetGoldText("") .. name,
-							cmdHidden = true,
-							order = 1,
-						},
-						reason = {
-							type = "description",
-							name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_STATUS"] .. ": ") .. reason,
-							cmdHidden = true,
-							order = 2,
-						},
-						issue = {
-							type = "description",
-							name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_ISSUE"] .. ": \n") .. issue,
-							cmdHidden = true,
-							order = 3,
-						},
-						notes = {
-							type = "description",
-							name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_NOTES"] .. ": \n") .. notes,
-							cmdHidden = true,
-							order = 4,
-						},
-						sp_1 = {
-							type = "description",
-							name = "",
-							cmdHidden = true,
-							order = 5,
-						},
-						category = {
-							type = "description",
-							name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_CATEGORY"] .. ": ") .. category,
-							cmdHidden = true,
-							order = 10,
-						},
-						ptype = {
-							type = "description",
-							name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_TYPE"] .. ": ") .. ptype, --.." "..btype,
-							cmdHidden = true,
-							order = 11,
-						},
-						button = {
-							type = "description",
-							name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_BUTTON"] .. ": ") .. button,
-							cmdHidden = true,
-							order = 12,
-						},
-						num_val = {
-							type = "description",
-							name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_TABLE"] .. ": ") .. num,
-							cmdHidden = true,
-							order = 13,
-						},
-					}
+			args[num] = {
+				type = "group",
+				name = title,
+				order = idx,
+				args = {
+					name = {
+						type = "description",
+						name = TitanUtils_GetGoldText("") .. name,
+						cmdHidden = true,
+						order = 1,
+					},
+					reason = {
+						type = "description",
+						name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_STATUS"] .. ": ") .. reason,
+						cmdHidden = true,
+						order = 2,
+					},
+					issue = {
+						type = "description",
+						name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_ISSUE"] .. ": \n") .. issue,
+						cmdHidden = true,
+						order = 3,
+					},
+					notes = {
+						type = "description",
+						name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_NOTES"] .. ": \n") .. notes,
+						cmdHidden = true,
+						order = 4,
+					},
+					sp_1 = {
+						type = "description",
+						name = "",
+						cmdHidden = true,
+						order = 5,
+					},
+					category = {
+						type = "description",
+						name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_CATEGORY"] .. ": ") .. category,
+						cmdHidden = true,
+						order = 10,
+					},
+					ptype = {
+						type = "description",
+						name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_TYPE"] .. ": ") .. ptype, --.." "..btype,
+						cmdHidden = true,
+						order = 11,
+					},
+					button = {
+						type = "description",
+						name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_BUTTON"] .. ": ") .. button,
+						cmdHidden = true,
+						order = 12,
+					},
+					num_val = {
+						type = "description",
+						name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_TABLE"] .. ": ") .. num,
+						cmdHidden = true,
+						order = 13,
+					},
 				}
-			end
+			}
 		end
 	end

diff --git a/Titan/TitanGame.lua b/Titan/TitanGame.lua
index a5b5103..d83a66e 100644
--- a/Titan/TitanGame.lua
+++ b/Titan/TitanGame.lua
@@ -1,6 +1,9 @@
 --[===[ File
-This file contains the 'game version' - Titan or TitanClassic.
-Used to set up libs, locale, ... per the WoW version the user is playing.
+NAME: TitanGame.lua
+DESC: This file contains the 'game version' Titan or TitanClassic. Used to set up libs, locale, ...
+Different folders are required because Titan used TitanClassic as a name (& folder) for the Classic WoW versions.
+The saved variables for Classic WoW are in TitanClassic.lua - not Titan.lua.
+:DESC
 --]===]

 TITAN_ID = "Titan"
diff --git a/Titan/TitanGlobal.lua b/Titan/TitanGlobal.lua
index 6c5595e..c91023d 100644
--- a/Titan/TitanGlobal.lua
+++ b/Titan/TitanGlobal.lua
@@ -150,6 +150,7 @@ Titan_Global.debug.plugin_text = false
 Titan_Global.debug.plugin_register = false
 Titan_Global.debug.plugin_register_deep = false
 Titan_Global.debug.movable = false
+Titan_Global.debug.titan_startup = false

 -- For WoW localized strings / literals we are using
 Titan_Global.literals = {
@@ -162,6 +163,20 @@ Titan_Global.literals = {
 	muted = MUTED,
 }

+Titan_Global.colors = {
+	alliance = "00adf0", -- PLAYER_FACTION_COLOR_ALLIANCE
+	blue = "0000ff", -- PURE_BLUE_COLOR
+	gold = "f2e699", -- GOLD_FONT_COLOR
+	gray = "808080", -- GRAY_FONT_COLOR
+	green = "19ff19", -- GREEN_FONT_COLOR
+	horde = "ff2934", -- PLAYER_FACTION_COLOR_HORDE
+	orange = "ff8c00",
+	red = "ff2020", -- RED_FONT_COLOR
+	white = "ffffff", -- HIGHLIGHT_FONT_COLOR
+	yellow_gold = "ffd200", -- NORMAL_FONT_COLOR
+	yellow = "ffff00", -- YELLOW_FONT_COLOR
+}
+
 -- type for plugin registry
 ---@class PluginRegistryType
 ---@field id string The unique name of the plugin
@@ -170,7 +185,7 @@ Titan_Global.literals = {
 ---@field menuText? string Localized string for the menu (right click)
 ---@field menuTextFunction? string | function Plugin function to call on right click
 ---@field buttonTextFunction? string | function Function to call when updating button display
----@field tooltipTitle? string Localized string for the menu
+---@field tooltipTitle? string Localized string for the menu
 ---@field tooltipTextFunction? string | function Function to call for a simple tooltip (OnEnter)
 ---@field tooltipCustomFunction? function Function to call for a complex tooltip (OnEnter)
 ---@field icon? string Path to the plugin icon
diff --git a/Titan/TitanHistory.lua b/Titan/TitanHistory.lua
index 54ce662..22041f7 100644
--- a/Titan/TitanHistory.lua
+++ b/Titan/TitanHistory.lua
@@ -15,10 +15,26 @@ Green - 'header' - Titan or plugin
 Highlight - notes. tips. and details
 --]]
 Titan_Global.recent_changes = ""
-.. TitanUtils_GetGoldText("8.0.13 : 2024/05/xx\n")
+.. TitanUtils_GetGoldText("8.0.14 : 2024/07/xx\n")
 .. TitanUtils_GetGreenText("Titan : \n")
 .. TitanUtils_GetHighlightText(""
-.. "- Update Retail version to 10.2.7.\n")
+.. "- AutoHide : Fix tooltip error; shows Enabled / Disabled.\n"
+.. "- Deprecated Titan Child template plugin code removed.\n"
+.. "- Cleanup Titan tool tip code.\n"
+.. "- Refactor Titan code to move color codes to Titan globals.\n"
+.. "- Add debug to Titan startup code.\n"
+)
+.. TitanUtils_GetGreenText("Clock, Location, Performance, Repair, Volume, XP : \n")
+.. TitanUtils_GetHighlightText(""
+.. "- Refactor code for IDE, mostly comments; some code.\n"
+.. "- Refactor code for Titan color code changes.\n"
+)
+.. "\n\n"
+.. TitanUtils_GetGoldText("8.0.13 : 2024/06/18\n")
+.. TitanUtils_GetGreenText("Titan : \n")
+.. TitanUtils_GetHighlightText(""
+.. "- Update Retail version to 10.2.7.\n"
+.. "- Unknown LDB will not print error to Chat. Remains in Config > Attempted.\n")
 .. TitanUtils_GetGreenText("Repair : \n")
 .. TitanUtils_GetHighlightText(""
 .. "- Change to not error in Beta (The War Within).\n")
@@ -74,12 +90,6 @@ Titan_Global.recent_changes = ""
         "- Deprecated the Titan 'child' template, it has not been used in years. Template and param will be deleted in a future release.\n"
     )
     .. "\n\n"
-    .. TitanUtils_GetGoldText("8.0.10 : 2024/03/14\n")
-    .. TitanUtils_GetGreenText("Titan : \n")
-    .. TitanUtils_GetHighlightText(""
-        .. "- TOC update only : Classic Era to 1.15.2.\n"
-    )
-    .. "\n\n"

 --[[ Var Notes
 Use for important notes in the Titan Config About
diff --git a/Titan/TitanLDB.lua b/Titan/TitanLDB.lua
index 76159f6..c65cc0f 100644
--- a/Titan/TitanLDB.lua
+++ b/Titan/TitanLDB.lua
@@ -897,7 +897,6 @@ function LDBToTitan:TitanLDBCreateObject(sender, name, obj)
 		{
 			self = nil,
 			button = nil,
-			isChild = nil,
 			name = tostring(name),
 			issue = ret_val,
 			notes = "",
@@ -944,7 +943,6 @@ LDBToTitan:SetScript("OnEvent", function(self, event, ...)
 				{
 					self = nil,
 					button = nil,
-					isChild = nil,
 					name = tostring(name),
 					issue = ret_val,
 					notes = "",
diff --git a/Titan/TitanTemplate.lua b/Titan/TitanTemplate.lua
index bedf8bd..ed825e9 100644
--- a/Titan/TitanTemplate.lua
+++ b/Titan/TitanTemplate.lua
@@ -24,7 +24,6 @@ The available plugin types are:
 - TitanPanelIconTemplate - * A frame that only displays an icon ("$parentIcon")
 - TitanPanelComboTemplate - * A frame that displays an icon then text ("$parentIcon"  "$parentText")
 - TitanOptionsSliderTemplate - A frame that contains the basics for a vertical slider control. See TitanVolume for an example.
-- TitanPanelChildButtonTemplate - A frame that allows a plugin within a plugin. !!! Not be used anymore!!!

 * Templates inherit TitanPanelButtonTemplate for common elements.

@@ -51,10 +50,7 @@ TitanPanelButtonTemplate contains:
 If these events are overridden then the default routine needs to be included!


-NOTE: TitanPanelChildButtonTemplate - !!! Not be used anymore!!!
-A much older version of TitanGold was an example.
-No third party plugins we are aware of have used this over the years. This scheme may not work and will be slowly removed from the code.
-
+NOTE: TitanPanelChildButtonTemplate - Removed 2024 Jun
 --]===]

 -- Globals
@@ -213,14 +209,14 @@ local function TitanTooltip_SetPanelTooltip(self, id, frame)
 	end
 end

----local Set the tooltip of the given Titan plugin.
----@param self table Tooltip frame
----@param id string Plugin id name
+---local Set the tooltip (GameTooltip) of the given Titan plugin.
+---@param self table Plugin frame
 --- Set Titan_Global.debug.tool_tips to output debug of this routine
-local function TitanPanelButton_SetTooltip(self, id)
+local function TitanPanelButton_SetTooltip(self)
 	local dbg_msg = "TT:"
 	local ok = false
 	local frame = GameTooltip
+	local id = self.registry.id

 	-- ensure that the 'self' passed is a valid frame reference
 	if self:GetName() then
@@ -265,6 +261,11 @@ local function TitanPanelButton_SetTooltip(self, id)

 		if ok and (id and TitanUtils_IsPluginRegistered(id)) then
 			local plugin = TitanUtils_GetPlugin(id)
+			-- 2024 Jun Add id and frame name to 'pass' to tooltip routine.
+			-- A compromise given that this mechanism is used by nearly all plugins.
+			-- Used by Titan auto hide to better determine which bar the 'pin' / icon is on.
+			self.plugin_id = id
+			self.plugin_frame = TitanUtils_ButtonName(id)
 			if (plugin and plugin.tooltipCustomFunction) then
 				-- Prep the tooltip frame
 				TitanTooltip_SetPanelTooltip(self, id, frame);
@@ -273,7 +274,7 @@ local function TitanPanelButton_SetTooltip(self, id)
 				self.tooltipCustomFunction = plugin.tooltipCustomFunction;
 				dbg_msg = dbg_msg .. " | custom"
 				call_success, -- for pcall
-				tmp_txt = pcall(self.tooltipCustomFunction)
+				tmp_txt = pcall(self.tooltipCustomFunction, self)
 				if call_success then
 					-- all is good
 					dbg_msg = dbg_msg .. " | ok"
@@ -304,7 +305,7 @@ local function TitanPanelButton_SetTooltip(self, id)
 					TitanTooltip_SetPanelTooltip(self, id, frame);
 					self.tooltipTitle = plugin.tooltipTitle;
 					call_success, -- for pcall
-					tmp_txt = pcall(tooltipTextFunc)
+					tmp_txt = pcall(tooltipTextFunc, self)

 					-- Fill the tooltip
 					self.tooltipText = tmp_txt
@@ -379,9 +380,6 @@ local function TitanPanelButton_OnDragStart(self)
 	if TitanPanelGetVar("LockButtons") or InCombatLockdown() then return end

 	local frname = self;
---	if ChildButton then
---		frname = self:GetParent();
---	end

 	-- Clear button positions or we'll grab the button and all buttons 'after'
 	for i, j in pairs(TitanPanelSettings.Buttons) do
@@ -423,10 +421,7 @@ local function TitanPanelButton_OnDragStart(self)

 	-- Hold the plugin id so we can do checks on the drop
 	TITAN_PANEL_MOVE_ADDON = TitanUtils_GetButtonID(self:GetName());
---	if ChildButton then
---		TITAN_PANEL_MOVE_ADDON =
---			TitanUtils_GetButtonID(self:GetParent():GetName());
---	end
+
 	-- Tell Titan that a drag & drop is in process
 	TITAN_PANEL_MOVING = 1;
 	-- Store the OnEnter handler so the tooltip does not show - or other oddities
@@ -447,9 +442,7 @@ local function TitanPanelButton_OnDragStop(self)
 	local nonmovableFrom = false;
 	local nonmovableTo = false;
 	local frname = self;
---	if ChildButton then
---		frname = self:GetParent();
---	end
+
 	if TITAN_PANEL_MOVING == 1 then
 		frname:StopMovingOrSizing();
 		frname.isMoving = false;
@@ -540,21 +533,19 @@ end

 ---API Handle the OnLoad event of the requested Titan plugin. Ensure the plugin is set to be registered.
 ---@param self table Plugin frame
----@param isChildButton boolean? If is child plugin !! NO LONGER USED !!
 --- This is called from the Titan plugin frame in the OnLoad event - usually as the frame is created in the Titan template.
-function TitanPanelButton_OnLoad(self, isChildButton)
+function TitanPanelButton_OnLoad(self)
 	-- Used by plugins
---[[
+	--[[
 --- This is called from the Titan plugin frame in the OnLoad event - usually as the frame is created in the Titan template.
 --- This starts the plugin registration process. See TitanUtils for more details on plugin registration.
---- The plugin registration is a two step process because not all addons create Titan plugins in the frame create.
+--- The plugin registration is a two step process because not all addons create Titan plugins in the frame create.
 --- The Titan feature of converting LDB addons to Titan plugins is an example.
---- If the plugin needs an OnLoad process it should call this routine after its own.
+--- If the plugin needs an OnLoad process it should call this routine after its own. I.E.
 --- TitanPanelLootTypeButton_OnLoad(self)
 --- TitanPanelButton_OnLoad(self)
 --]]
---	TitanUtils_PluginToRegister(self, isChildButton)
-	TitanUtils_PluginToRegister(self, false)
+	TitanUtils_PluginToRegister(self)
 end

 ---API Handle the OnShow event of the requested Titan plugin.
@@ -574,17 +565,12 @@ end
 ---API Handle the OnClick mouse event of the requested Titan plugin.
 ---@param self table Plugin frame
 ---@param button string Mouse button clicked
----@param isChildButton boolean? If is child plugin ! NO LONGER USED !
 --- Only the left and right mouse buttons are handled by Titan.
 --- Called from Titan templates unless overriden by plugin. If overridden the plugin should call this routine.
-function TitanPanelButton_OnClick(self, button, isChildButton)
+function TitanPanelButton_OnClick(self, button)
 	local id
 	-- ensure that the 'self' passed is a valid frame reference
 	if self and self:GetName() then
---[[		id = TitanUtils_Ternary(isChildButton,
-			TitanUtils_GetParentButtonID(self:GetName()),
-			TitanUtils_GetButtonID(self:GetName()));
---]]
 		id = TitanUtils_GetButtonID(self:GetName())
 	end

@@ -654,17 +640,12 @@ end

 ---API Handle the OnEnter event of the requested Titan plugin.
 ---@param self table Plugin frame
----@param isChildButton boolean? If is child plugin ! NO LONGER USED !
 --- 1. The cursor has moved over the plugin so show the plugin tooltip.
 --- 2. Return if plugin "is moving" or if tooltip is already shown.
-function TitanPanelButton_OnEnter(self, isChildButton)
+function TitanPanelButton_OnEnter(self)
 	local id = nil;
 	-- ensure that the 'self' passed is a valid frame reference
 	if self and self:GetName() then
---[[		id = TitanUtils_Ternary(isChildButton,
-			TitanUtils_GetParentButtonID(self:GetName()),
-			TitanUtils_GetButtonID(self:GetName()));
---]]
 		id = TitanUtils_GetButtonID(self:GetName())
 	end

@@ -676,7 +657,7 @@ function TitanPanelButton_OnEnter(self, isChildButton)
 			return;
 		else
 			if TITAN_PANEL_MOVING == 0 then
-				TitanPanelButton_SetTooltip(self, id);
+				TitanPanelButton_SetTooltip(self);
 			end
 			if self.isMoving then
 				GameTooltip:Hide();
@@ -687,15 +668,11 @@ end

 ---API Handle the OnLeave event of the requested Titan plugin.
 ---@param self table Plugin frame
----@param isChildButton boolean? If is child plugin ! NO LONGER USED !
 --- 1. The cursor has moved over the plugin so hide the plugin tooltip.
-function TitanPanelButton_OnLeave(self, isChildButton)
+function TitanPanelButton_OnLeave(self)
 	local id = nil;
 	-- ensure that the 'self' passed is a valid frame reference
 	if self and self:GetName() then
---		id = TitanUtils_Ternary(isChildButton,
---			TitanUtils_GetParentButtonID(self:GetName()),
---			TitanUtils_GetButtonID(self:GetName()));
 		id = TitanUtils_GetButtonID(self:GetName())
 	end

@@ -786,7 +763,7 @@ local function TitanPanelButton_SetButtonText(id)
 				text = true
 			else
 				buttonText:SetText("<?>")
-				dbg_msg = dbg_msg .. " | Err '"..tostring(label1).."'"
+				dbg_msg = dbg_msg .. " | Err '" .. tostring(label1) .. "'"
 			end
 		else
 			dbg_msg = dbg_msg .. " | invalid plugin id"
@@ -800,7 +777,7 @@ local function TitanPanelButton_SetButtonText(id)
 		-- Plugin MUST have been shown at least once.

 		-- In the case of first label only (no value), set the button and return.
-		if text and
+		if text and
 			label1 and
 			not (label2 or label3 or label4
 				or value1 or value2 or value3 or value4) then
@@ -932,8 +909,8 @@ end
 --- Wrap up by (re)drawing the plugins on the Bar.
 --- Titan uses a tolerance setting to prevent endless updating of the text width.
 local function TitanPanelButton_SetComboButtonWidth(id, setButtonWidth)
--- TODO - ensure this routine is proper - need this param?
--- icon width default to .registry.iconWidth before getting the actual width
+	-- TODO - ensure this routine is proper - need this param?
+	-- icon width default to .registry.iconWidth before getting the actual width
 	if (id) then
 		local button = TitanUtils_GetButton(id)
 		if not button then return end -- sanity check
@@ -1015,7 +992,7 @@ function TitanPanelButton_UpdateTooltip(self)
 	if (GameTooltip:IsOwned(self)) then
 		local id = TitanUtils_GetButtonID(self:GetName());

-		TitanPanelButton_SetTooltip(self, id);
+		TitanPanelButton_SetTooltip(self);
 	end
 end

@@ -1023,7 +1000,7 @@ end
 ---@param table table | string Either {plugin id, action} OR plugin id
 ---@param oldarg string? action OR nil
 --- This is used by some plugins. It is not used within Titan.
---- Action :
+--- Action :
 --- 1 = refresh button
 --- 2 = refresh tooltip
 --- 3 = refresh button and tooltip
@@ -1056,21 +1033,17 @@ function TitanPanelPluginHandle_OnUpdate(table, oldarg)
 				return
 			end

-			TitanPanelButton_SetTooltip(_G[TitanUtils_ButtonName(id)], id)
+			TitanPanelButton_SetTooltip(_G[TitanUtils_ButtonName(id)])
 		end
 	end
 end

 ---Titan Poorly named routine that sets the OnDragStart & OnDragStop scripts of a Titan plugin.
 ---@param id string Plugin id
----@param isChildButton boolean? If is child plugin
-function TitanPanelDetectPluginMethod(id, isChildButton)
+function TitanPanelDetectPluginMethod(id)
 	-- Ensure the id is not nil
 	if not id then return end
 	local TitanPluginframe = _G[TitanUtils_ButtonName(id)];
---	if isChildButton then
---		TitanPluginframe = _G[id];
---	end
 	-- Ensure the frame is valid
 	if not TitanPluginframe and TitanPluginframe:GetName() then return end -- sanity check...

@@ -1079,21 +1052,13 @@ function TitanPanelDetectPluginMethod(id, isChildButton)
 		if not IsShiftKeyDown()
 			and not IsControlKeyDown()
 			and not IsAltKeyDown() then
---			if isChildButton then
---				TitanPanelButton_OnDragStart(self, true);
---			else
-				TitanPanelButton_OnDragStart(self);
---			end
+			TitanPanelButton_OnDragStart(self);
 		end
 	end)

 	-- Set the OnDragStop script
 	TitanPluginframe:SetScript("OnDragStop", function(self)
---		if isChildButton then
---			TitanPanelButton_OnDragStop(self, true)
---		else
-			TitanPanelButton_OnDragStop(self);
---		end
+		TitanPanelButton_OnDragStop(self);
 	end)
 end

diff --git a/Titan/TitanTemplate.xml b/Titan/TitanTemplate.xml
index 5ebeb7a..72133b9 100644
--- a/Titan/TitanTemplate.xml
+++ b/Titan/TitanTemplate.xml
@@ -19,22 +19,6 @@
 			</OnLeave>
 		</Scripts>
 	</Button>
-	<Button name="TitanPanelChildButtonTemplate" hidden="true" virtual="true">
-		<Scripts>
-			<OnLoad>
-				TitanPanelButton_OnLoad(self, true);
-			</OnLoad>
-			<OnClick>
-				TitanPanelButton_OnClick(self, button, true);
-			</OnClick>
-			<OnEnter>
-				TitanPanelButton_OnEnter(self, true);
-			</OnEnter>
-			<OnLeave>
-				TitanPanelButton_OnLeave(self, true);
-			</OnLeave>
-		</Scripts>
-	</Button>
 	<Button name="TitanPanelTextTemplate" inherits="TitanPanelButtonTemplate" virtual="true">
 		<Size>
 			<AbsDimension x="0" y="16" />
diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua
index da6eb3b..b245ea1 100644
--- a/Titan/TitanUtils.lua
+++ b/Titan/TitanUtils.lua
@@ -306,7 +306,7 @@ else -- only retail (may change as Blizz expands API to Classic versions)
 		-- Used by addons
 		TitanMovable_AddonAdjust(frame, bool)
 	end
-end -- Retail versus retail routines
+end -- Classic versus Retail routines

 --====== The routines labeled API are useable by addon developers

@@ -381,61 +381,6 @@ function TitanUtils_GetButtonID(name)
 	end
 end

----Titan Return the plugin id of the parent of the given name, if it exists.
----@param name string Plugin frame name
----@return string? PluginId
----Used for Titan child templates which may not work...
-function TitanUtils_GetParentButtonID(name)
-	local frame = TitanUtils_Ternary(name, _G[name], nil);
-
-	if (frame and frame:GetParent()) then
-		return TitanUtils_GetButtonID(frame:GetParent():GetName());
-	end
-end
-
----Titan Return the plugin id of whatever the mouse is over. Used in the right click menu on load.
----@param self table Plugin frame
----@return string? PluginId could be the Titan ("Bar") or a plugin or nil.
-function TitanUtils_GetButtonIDFromMenu(self)
-	local ret = nil
-	local temp
-	if self and self:GetParent() then
-		local name = self:GetParent():GetName()
-		if name == "UIParent" then
-			-- The click was on the Titan bar itself
-			ret = "Bar";
-		elseif self:GetParent():GetParent():GetName() then
-			local pname = self:GetParent():GetParent():GetName()
-			-- TitanPanelChildButton
-			-- expecting this to be a TitanPanelChildButtonTemplate
-			temp = TitanUtils_GetButtonID(pname)
-			if temp then
-				-- should be ok
-				ret = temp
-			else
-				-- the frame container is expected to be without a name
-				-- This trips when the user right clicks a LDB plugin...
-			end
-		else
-			-- TitanPanelButton
-			temp = TitanUtils_GetButtonID(self:GetParent():GetName())
-			if temp then
-				-- should be ok
-				ret = temp
-			else
-				TitanDebug("Could not determine Titan ID for '"
-					.. (self:GetParent():GetParent() or "?") .. "'. "
-					, "error")
-			end
-		end
-	else
-		TitanDebug("Could not determine Titan ID from menu. "
-		, "error")
-	end
-
-	return ret
-end
-
 ---Titan Return the plugin itself (table and all).
 ---@param id string Unique ID of the plugin
 ---@return table? table plugin data
@@ -730,30 +675,42 @@ function TitanUtils_PrintArray(array)
 	end
 end

----API Routine that returns red string with proper start and end font encoding.
+---local Routine that returns the given string with proper start and end font encoding.
+---@param color string Hex color code
 ---@param text string Text to wrap
----@return string text Red color encoded string
-function TitanUtils_GetRedText(text)
+---@return string text Color encoded string
+local function Encode(color, text)
+	-- This does the sanity checks for the Get<color> routines below
 	local res = ""
-	if (text) then
-		res = _G["RED_FONT_COLOR_CODE"] .. text .. _G["FONT_COLOR_CODE_CLOSE"];
+	local c = tostring(color)
+	local t = tostring(text)
+	if (c and t) then
+		res = "|cff" .. c .. t .. "|r"
 	else
-		res = _G["GRAY_FONT_COLOR"] .. tostring(text) .. _G["FONT_COLOR_CODE_CLOSE"]
+		if (t) then
+			res = tostring(t)
+		else
+			-- return blank string
+		end
 	end

 	return res
 end

+---API Routine that returns red string with proper start and end font encoding.
+---@param text string Text to wrap
+---@return string text Red color encoded string
+function TitanUtils_GetRedText(text)
+	local res = Encode(Titan_Global.colors.red, text)
+
+	return res
+end
+
 ---API Routine that returns gold string with proper start and end font encoding.
 ---@param text string Text to wrap
 ---@return string text Gold color encoded string
 function TitanUtils_GetGoldText(text)
-	local res = ""
-	if (text) then
-		res = "|cffffd700" .. text .. _G["FONT_COLOR_CODE_CLOSE"];
-	else
-		res = _G["GRAY_FONT_COLOR"] .. tostring(text) .. _G["FONT_COLOR_CODE_CLOSE"]
-	end
+	local res = Encode(Titan_Global.colors.gold, text)

 	return res
 end
@@ -762,12 +719,7 @@ end
 ---@param text string Text to wrap
 ---@return string text Green color encoded string
 function TitanUtils_GetGreenText(text)
-	local res = ""
-	if (text) then
-		res = _G["GREEN_FONT_COLOR_CODE"] .. text .. _G["FONT_COLOR_CODE_CLOSE"];
-	else
-		res = _G["GRAY_FONT_COLOR"] .. tostring(text) .. _G["FONT_COLOR_CODE_CLOSE"]
-	end
+	local res = Encode(Titan_Global.colors.green, text)

 	return res
 end
@@ -776,26 +728,25 @@ end
 ---@param text string Text to wrap
 ---@return string text Blue color encoded string
 function TitanUtils_GetBlueText(text)
-	local res = ""
-	if (text) then
-		res = "|cff0000ff" .. text .. _G["FONT_COLOR_CODE_CLOSE"];
-	else
-		res = _G["GRAY_FONT_COLOR"] .. tostring(text) .. _G["FONT_COLOR_CODE_CLOSE"]
-	end
+	local res = Encode(Titan_Global.colors.blue, text)
+
+	return res
+end
+
+---API Routine that returns gray string with proper start and end font encoding.
+---@param text string Text to wrap
+---@return string text Gray color encoded string
+function TitanUtils_GetGrayText(text)
+	local res = Encode(Titan_Global.colors.gray, text)

 	return res
 end

----API Routine that returns normal color (gray-white) string with proper start and end font encoding.
+---API Routine that returns normal color string with proper start and end font encoding.
 ---@param text string Text to wrap
 ---@return string text Normal color encoded string
 function TitanUtils_GetNormalText(text)
-	local res = ""
-	if (text) then
-		res = _G["NORMAL_FONT_COLOR_CODE"] .. text .. _G["FONT_COLOR_CODE_CLOSE"];
-	else
-		res = _G["GRAY_FONT_COLOR"] .. tostring(text) .. _G["FONT_COLOR_CODE_CLOSE"]
-	end
+	local res = Encode(Titan_Global.colors.yellow_gold, text)

 	return res
 end
@@ -804,12 +755,7 @@ end
 ---@param text string Text to wrap
 ---@return string text Highlight color encoded string
 function TitanUtils_GetHighlightText(text)
-	local res = ""
-	if (text) then
-		res = _G["HIGHLIGHT_FONT_COLOR_CODE"] .. text .. _G["FONT_COLOR_CODE_CLOSE"];
-	else
-		res = _G["GRAY_FONT_COLOR"] .. tostring(text) .. _G["FONT_COLOR_CODE_CLOSE"]
-	end
+	local res = Encode(Titan_Global.colors.white, text)

 	return res
 end
@@ -821,14 +767,18 @@ end
 --- TitanUtils_GetColoredText(GOLD_PERHOUR_STATUS, TITAN_GOLD_GREEN)
 function TitanUtils_GetColoredText(text, color)
 	local res = ""
-	if (text and color) then
+	if (color and text) then
 		local redColorCode = format("%02x", color.r * 255);
 		local greenColorCode = format("%02x", color.g * 255);
 		local blueColorCode = format("%02x", color.b * 255);
-		local colorCode = "|cff" .. redColorCode .. greenColorCode .. blueColorCode;
-		res = colorCode .. text .. _G["FONT_COLOR_CODE_CLOSE"];
+		local colorCode = redColorCode .. greenColorCode .. blueColorCode;
+		res = Encode(colorCode, text)
 	else
-		res = _G["GRAY_FONT_COLOR_CODE"] .. tostring(text) .. _G["FONT_COLOR_CODE_CLOSE"]
+		if (text) then
+			res = tostring(text)
+		else
+			-- return blank string
+		end
 	end

 	return res
@@ -840,12 +790,7 @@ end
 ---@return string text Custom color encoded string
 ---TitanUtils_GetHexText(player.faction, "d42447") -- Horde
 function TitanUtils_GetHexText(text, hex)
-	local res = ""
-	if (text and hex) then
-		res = "|cff" .. tostring(hex) .. text .. _G["FONT_COLOR_CODE_CLOSE"]
-	else
-		res = _G["GRAY_FONT_COLOR"] .. tostring(text) .. _G["FONT_COLOR_CODE_CLOSE"]
-	end
+	local res = Encode(hex, text)

 	return res
 end
@@ -1185,6 +1130,13 @@ end
 ---API Set backdrop of the plugin. Used for custom created controls (Clock / Volume) to give a consistent look.
 ---@param frame table Plugin control frame
 function TitanPanelRightClickMenu_SetCustomBackdrop(frame)
+--[[
+Blizzard decided to remove direct Backdrop API in 9.0 (Shadowlands)
+so inherit the template (XML) and set the values in the code (Lua)
+
+9.5 The tooltip template was removed from the GameTooltip.
+--]]
+
 	frame:SetBackdrop({
 		bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
 		edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
@@ -1228,7 +1180,7 @@ end
 --


----local This will swap two buttons on the Titan bars. Once swapped then 'reinit' the buttons to show properly.
+---local This will swap two buttons on the Titan bars. Once swapped then 'reinit' the buttons to show properly.
 --- This is currently used as part of the shift left / right on same bar.
 ---@param from_id integer Plugin id
 ---@param to_id integer Plugin id
@@ -1427,18 +1379,6 @@ function TitanUtils_CloseAllControlFrames()
 	end
 end

---[[ 2024 Mar commented out - not used by Titan
-function TitanUtils_IsAnyControlFrameVisible() -- need?
-	for index, value in TitanPlugins do
-		local frame = _G["TitanPanel" .. index .. "ControlFrame"];
-		if (frame:IsVisible()) then
-			return true;
-		end
-	end
-	return false;
-end
---]]
-
 ---Titan Check if the control frame is on screen.
 --- Used for Plugins AND Titan
 ---@param frame table Frame name likely tooltip
@@ -1506,19 +1446,19 @@ end
 ---Titan Store the plugin to be registered later by Titan
 --- See comments in the routine for more details.
 ---@param self table Plugin frame
----@param isChildButton boolean? !! Not Used !!
-function TitanUtils_PluginToRegister(self, isChildButton)
-	-- 2024 Mar -- removed isChildButton since it has not been used in years to my knowledge :)
+function TitanUtils_PluginToRegister(self)
 	--[[
-- .registry is part of 'self' (the Titan plugin frame) which works great for Titan specific plugins.
+- .registry is part of 'self' (the Titan plugin frame).
   Titan plugins create the registry as part of the frame _OnLoad.
-  But this does not work for LDB buttons. The frame is created THEN the registry is added to the frame.
+  For LDB buttons the frame and the registry are created during the processing of the LDB object.
 - Any read of the registry must assume it may not exist. Also assume the registry could be updated after this routine.
-- This is called when a Titan plugin frame is created. Normally these are held until the player 'enters world' then the plugin is registered.
-  Sometimes plugin frames are created after this process. Right now only LDB plugins are handled. If someone where to start creating Titan frames after the registration process were complete then it would fail to be registered...
--!For LDB plugins the 'registry' is attached to the frame AFTER the frame is created...
-- The fields put into "Attempted" are defaulted here in preperation of being registered.
+- This is called when a Titan plugin frame is created.
+- These entries are held until the 'player entering world' event then the plugin list is registered.
+- Sometimes plugin frames are created after this process. Right now only LDB plugins are handled.
+If someone where to start creating Titan frames after the registration process were complete then it would fail to be registered...
+- The fields put into Config > "Attempted" are defaulted here in preperation of being registered.
 	--]]
+
 	TitanPluginToBeRegisteredNum = TitanPluginToBeRegisteredNum + 1
 	local cat = ""
 	local notes = ""
@@ -1528,13 +1468,11 @@ function TitanUtils_PluginToRegister(self, isChildButton)
 		notes = (self.registry.notes or "")
 		name = (self.registry.id or "")
 	end
-	-- Some of the fields in this record are displayed in the "Attempts"
-	-- so they are defaulted here.
+	-- The fields displayed in "Attempts" are defaulted here.
 	TitanPluginToBeRegistered[TitanPluginToBeRegisteredNum] = {
 		self = self,
 		button = ((self and self:GetName()
 			or "Nyl" .. "_" .. TitanPluginToBeRegisteredNum)),
-		isChild = false, -- (isChildButton and true or false),
 		-- fields below are updated when registered
 		name = "?",
 		issue = "",
@@ -1571,7 +1509,6 @@ function TitanUtils_PluginFail(plugin)
 	{
 		self = plugin.self,
 		button = (plugin.button and plugin.button:GetName() or ""),
-		isChild = (plugin.isChild and true or false),
 		name = (plugin.name or "?"),
 		issue = (plugin.issue or "?"),
 		status = (plugin.status or "?"),
@@ -1579,7 +1516,7 @@ function TitanUtils_PluginFail(plugin)
 		plugin_type = (plugin.plugin_type or ""),
 	}

---[[ 2024/06/18 : Removed per comment on Curse. Still in Attempted
+	--[[ 2024/06/18 : Removed per comment on Curse. Still in Config > Attempted
 	local message = ""
 		.. " '" .. tostring(TitanPluginToBeRegistered[TitanPluginToBeRegisteredNum].status) .. "'"
 		.. " '" .. tostring(TitanPluginToBeRegistered[TitanPluginToBeRegisteredNum].name) .. "'"
@@ -1590,8 +1527,8 @@ function TitanUtils_PluginFail(plugin)
 end

 ---local Strip the WoW color string(s) from the given string
----@param name string
----@return string NoColor
+---@param name string
+---@return string NoColor
 local function NoColor(name)
 	local no_color = name

@@ -1607,7 +1544,7 @@ end
 ---@return table Results of the registration - pass (TitanPlugins) or fail
 --- See routine for output table values
 local function TitanUtils_RegisterPluginProtected(plugin)
---[[
+	--[[
 OUT:
 	.issue	: Show the user what prevented the plugin from registering
 	.result	: Used so we know which plugins were processed
@@ -1620,7 +1557,7 @@ NOTE:
   And attempt to tell the user / developer what went wrong.
 - If successful the plugin will be in TitanPlugins as a registered plugin and will be available for display on the Titan bars.
 --]]
-local result = ""
+	local result = ""
 	local issue = ""
 	local id = ""
 	local cat = ""
@@ -1629,18 +1566,8 @@ local result = ""
 	local str = ""

 	local self = plugin.self
-	--	local isChildButton = (plugin.isChild and true or false)

 	if self and self:GetName() then
-		--		if (isChildButton) then
-		--			-- This is a button within a button
-		--			self:RegisterForClicks("LeftButtonUp", "RightButtonUp", "MiddleButtonUp");
-		--			self:RegisterForDrag("LeftButton")
-		--			TitanPanelDetectPluginMethod(self:GetName(), true);
-		--			result = TITAN_REGISTERED
-		-- give some indication that this is valid...
-		--			id = (self:GetName() or "") .. "<child>"
-		--		else
 		-- Check for the .registry where all the Titan plugin info is expected
 		if (self.registry and self.registry.id) then
 			id = self.registry.id
@@ -1812,11 +1739,6 @@ function TitanUtils_RegisterPlugin(plugin)
 		-- Debug
 		if Titan_Global.debug.plugin_register then
 			local status = plugin.status
-			if plugin.status == TITAN_REGISTER_FAILED then
-				status = TitanUtils_GetRedText(status)
-			else
-				status = TitanUtils_GetGreenText(status)
-			end
 			TitanDebug("Registering Plugin"
 				.. " " .. tostring(plugin.name) .. ""
 				.. " " .. tostring(status) .. ""
@@ -1872,31 +1794,47 @@ end

 ---local Prepare the plugin right click menu using the function given by the plugin OR Titan bar.
 ---@param self table Titan Bar or Plugin frame
---- See the routine for details on determining the menu function.
+---@param menu table Frame to use as the menu
+--- Determining the menu function
+--- Old "TitanPanelRightClickMenu_Prepare"..plugin_id.."Menu"
+--- New : .menuTextFunction in registry
 --- UIDropDownMenu_Initialize will place (part of) the error in the menu - it is not progagated out.
 --- Set Titan_Global.debug.menu to output the error to Chat.
-local function TitanRightClickMenu_OnLoad(self)
---[[
+local function TitanRightClickMenu_OnLoad(self, menu)
+	--[[
 - The function to create the menu is either
-1. set in registry in .menuTextFunction
-: New in 2024 Feb to make the routine explicit (UIDropDownMenu_Initialize appears to be 'safe')
-: If a function then the routine can be local or in the global namespace
-: If a string then the routine MUST be in the global namespace.
-2. assumed to be "TitanPanelRightClickMenu_Prepare"..plugin_id.."Menu" : This is the way Titan was written
-- TitanUtils_GetButtonIDFromMenu returns a generic "Bar" when the user clicks on a Titan bar.
-  This works because every Titan bar uses the same menu allowing one routine to be reused.
+1. Set in registry in .menuTextFunction
+: New in 2024 Feb to allow the menu routine name to be explicit rather than assumed
+: If .menuTextFunction ia a function then the routine can be local or in the global namespace
+: If .menuTextFunction ia a string then the routine MUST be in the global namespace.
+2. Assumed to be "TitanPanelRightClickMenu_Prepare"..plugin_id.."Menu"
+: This is the way Titan was written in the beginning so we leave it to not break Classic Era and older plugins.
+: If menu is for a Titan bar then use TitanPanelRightClickMenu_PrepareBarMenu for ALL Titan bars.
 --]]
-	local id = TitanUtils_GetButtonIDFromMenu(self) -- "Bar" if self is any Titan bar
+	local id = ""
 	local err = ""
-	if id then
-		local frame = TitanUtils_GetPlugin(id) -- get plugin frame
-		local prepareFunction -- function to call
+
+	if self.registry then
+		id = self.registry.id -- is a plugin
+	else
+		id = "Bar"  -- is a Titan bar
+	end
+
+	if id == "" then
+		err = "Could not display tooltip. "
+			.. "Unknown Titan ID for "
+			.. "'" .. (self:GetName() or "?") .. "'. "
+	else
+--		local frame = TitanUtils_GetPlugin(id) -- get plugin frame
+		local frame = self.registry
+		local prepareFunction            -- function to call

 		if frame and frame.menuTextFunction then
 			prepareFunction = frame.menuTextFunction -- Newer method 2024 Feb
 		else
-			-- If 'bar' then routine for ALL Titan bars
+			-- Older method used when Titan was created
 			prepareFunction = "TitanPanelRightClickMenu_Prepare" .. id .. "Menu"
+			--
 		end

 		if type(prepareFunction) == 'string' then
@@ -1911,7 +1849,7 @@ local function TitanRightClickMenu_OnLoad(self)
 		end

 		if prepareFunction then
-			UIDropDownMenu_Initialize(self, prepareFunction, "MENU")
+			UIDropDownMenu_Initialize(menu, prepareFunction, "MENU")
 		else
 			err = "Could not display tooltip. "
 				.. "No function for '" .. tostring(id) .. "' "
@@ -1919,10 +1857,6 @@ local function TitanRightClickMenu_OnLoad(self)
 				.. "[" .. tostring(prepareFunction) .. "] "
 				.. ". "
 		end
-	else
-		err = "Could not display tooltip. "
-			.. "Unknown Titan ID for "
-			.. "'" .. (self:GetName() or "?") .. "'. "
 	end

 	if Titan_Global.debug.menu then
@@ -1952,7 +1886,7 @@ print("_ toggle R menu"
 )
 --]]
 	-- Create menu based on the frame's routine for right click menu
-	local drop_menu, menu_height, menu_width = TitanRightClickMenu_OnLoad(menu)
+	local drop_menu, menu_height, menu_width = TitanRightClickMenu_OnLoad(self, menu)

 	-- Adjust the Y offset as needed
 	local rel_y = _G[frame]:GetTop() - menu_height
@@ -2194,7 +2128,7 @@ function TitanPrint(message, msg_type)
 	if msg_type == "error" then
 		dtype = TitanUtils_GetRedText("Error: ")
 	elseif msg_type == "warning" then
-		dtype = "|cFFFFFF00" .. "Warning: " .. _G["FONT_COLOR_CODE_CLOSE"]
+		dtype = TitanUtils_GetHexText("Warning: ", Titan_Global.colors.yellow)
 	elseif msg_type == "plain" then
 		pre = ""
 	elseif msg_type == "header" then
@@ -2376,34 +2310,4 @@ end
 --
 --[===[

-Below 2024 Mar
-
-This routine is really broken... unlikely it worked.
---[[   API
-NAME: TitanPanelRightClickMenu_AddToggleColoredText
-DESC: This will toggle the "ShowColoredText" Titan variable then update the button
-VAR: id - id of the plugin
-VAR: level - level to put the line
-OUT:  None
---]]
-function TitanPanelRightClickMenu_ToggleColoredText(value)
-	TitanToggleVar(value, "ShowColoredText");
-	TitanPanelButton_UpdateButton(value, 1);
-end
-
----API Check if all the variables in the table are nil/false.
----@param id string Plugin id
----@param toggleTable table {}
----@return boolean all_nil true (1) or nil
-function TitanPanelRightClickMenu_AllVarNil(id, toggleTable)
-	if ( toggleTable ) and type(toggleTable)== "table" then
-		for i, v in toggleTable do
-			if ( TitanGetVar(id, v) ) then
-				return nil;
-			end
-		end
-		return 1;
-	end
-end
-
 --]===]
diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua
index f45e0b9..04b8ae5 100644
--- a/Titan/TitanVariables.lua
+++ b/Titan/TitanVariables.lua
@@ -939,9 +939,8 @@ end
 ---Titan Ensure TitanSettings (one of the saved vars in the toc) exists and set the Titan version.
 --- Called when Titan is loaded (ADDON_LOADED event)
 function TitanVariables_InitTitanSettings()
-	local trace = false
 	local player = TitanUtils_GetPlayer()
-	if trace then
+	if Titan_Global.debug.titan_startup then
 		TitanDebug("_Init begin " .. tostring(player))
 	end

@@ -949,7 +948,7 @@ function TitanVariables_InitTitanSettings()
 		-- all is good
 	else
 		TitanSettings = {}
-		if trace then
+		if Titan_Global.debug.titan_startup then
 			TitanDebug("TitanSettings {}")
 		end
 	end
@@ -959,7 +958,7 @@ function TitanVariables_InitTitanSettings()
 		-- all is good
 	else
 		TitanSettings.Players = {} -- empty saved vars. New install or wipe
-		if trace then
+		if Titan_Global.debug.titan_startup then
 			TitanDebug("TitanSettings.Players {}")
 		end
 	end
@@ -969,9 +968,16 @@ function TitanVariables_InitTitanSettings()
 	else
 		TitanAll = {}
 	end
+
+	if Titan_Global.debug.titan_startup then
+		TitanDebug("Sync Titan Panel saved variables with TitanAll  ")
+	end
 	TitanVariables_SyncRegisterSavedVariables(TITAN_ALL_SAVED_VARIABLES, TitanAll)
+	if Titan_Global.debug.titan_startup then
+		TitanDebug("Sync Done  ")
+	end

-	if trace then
+	if Titan_Global.debug.titan_startup then
 		TitanDebug("_Init end " .. tostring(player))
 	end

@@ -1061,18 +1067,16 @@ end

 ---local Set the Titan bar settings of the given profile from saved variables
 ---@param to_profile string
----@param trace boolean?
 --- If no profile found, use Titan defaults
-local function Set_bar_vars(to_profile, trace)
-	local tracer = (trace or false)
+local function Set_bar_vars(to_profile)
 	if TitanSettings.Players[to_profile].BarVars then
 		-- All good
-		if tracer then
+		if Titan_Global.debug.titan_startup then
 			print("Set_bar_vars found"
 			)
 		end
 	else
-		if tracer then
+		if Titan_Global.debug.titan_startup then
 			print("Set_bar_vars init"
 			)
 		end
@@ -1084,7 +1088,7 @@ local function Set_bar_vars(to_profile, trace)
 		local panel = TitanSettings.Players[to_profile].Panel

 		local tex = panel["TexturePath"]:gsub("TitanClassic", "Titan")
-		if tracer then
+		if Titan_Global.debug.titan_startup then
 			print("tex path '" .. tex .. "'")
 		end

@@ -1125,14 +1129,12 @@ local function Init_player_settings(from_profile, to_profile, action)
  From: saved variables of that profile
  To: Player or Global profile
 	--]]
-	local trace = false
-
 	local old_player = {}
 	local old_panel = {}
 	local old_plugins = {}
 	local reset = (action == TITAN_PROFILE_RESET)

-	if trace then
+	if Titan_Global.debug.titan_startup then
 		print("Init_player_settings"
 			.. " from: " .. tostring(from_profile) .. ""
 			.. " to: " .. tostring(to_profile) .. ""
@@ -1146,7 +1148,7 @@ local function Init_player_settings(from_profile, to_profile, action)
 		-- all is good
 	else
 		-- Create the bare player tables so profile(s) can be added
-		if trace then
+		if Titan_Global.debug.titan_startup then
 			TitanDebug("TitanSettings.Players[] {}")
 		end
 		TitanSettings.Players[to_profile] = {}
@@ -1183,7 +1185,7 @@ local function Init_player_settings(from_profile, to_profile, action)
 	-- ======

 	-- ====== New Mar 2023 : TitanSettings.Players[player].BarData to hold Short bar data
-	Set_bar_vars(to_profile, trace)
+	Set_bar_vars(to_profile)
 	-- ======
 	if action == TITAN_PROFILE_RESET then
 		-- default is global profile OFF
@@ -1208,7 +1210,7 @@ local function Init_player_settings(from_profile, to_profile, action)
 			Set_bar_vars(from_profile)
 			TitanSettings.Players[to_profile]["BarVars"] = deepcopy(old_player["BarVars"])

-			if trace then
+			if Titan_Global.debug.titan_startup then
 				-- Apply the new bar positions
 				for idx, v in pairs(TitanBarData) do
 					print("BarVars "
diff --git a/Titan/_TitanIDE.lua b/Titan/_TitanIDE.lua
index 0bd7768..a6232c6 100644
--- a/Titan/_TitanIDE.lua
+++ b/Titan/_TitanIDE.lua
@@ -37,7 +37,6 @@

 --====== Frames from Titan Template XML
 TitanPanelButtonTemplate = {}
-TitanPanelChildButtonTemplate = {}
 TitanPanelTextTemplate = {}
 TitanPanelIconTemplate = {}
 TitanPanelComboTemplate = {}
@@ -121,7 +120,7 @@ VideoOptionsFrameOkay_OnClick = {}
 -- Lua allows table updates but the IDE complains about 'injecting' a field it does not know about.
 -- Adding a function or variable to a frame in this case.

----@class Frame Plugin frame from a Titan template
+---@class Button Plugin frame from a Titan template
 ---@field TitanLDBSetOwnerPosition function Anchor tooltip
 ---@field TitanLDBSetTooltip function Fill tooltip
 ---@field TitanLDBHandleScripts function Set frame scripts
@@ -134,6 +133,7 @@ VideoOptionsFrameOkay_OnClick = {}
 ---@field TitanAction string Not used ATM
 ---@field bar_name string Used by auto hide built-in
 ---@field registry table Any Titan plugin (built-in; third party; or LDB)
+---@field tooltipText string Titan text for the tool tip

 ---@class UIParent WoW frame
 ---@field GetScale function WoW region routine
@@ -141,6 +141,7 @@ VideoOptionsFrameOkay_OnClick = {}
 ---@class Button Plugin frame
 ---@field RequestTimePlayed table Override default - XP
 ---@field TIME_PLAYED_MSG table Override default - XP
+---@field short_name string Placeholder for short bar name


 --====== WoW Drop down menu
diff --git a/TitanClassic/TitanGame.lua b/TitanClassic/TitanGame.lua
index e33e8d0..50e0726 100644
--- a/TitanClassic/TitanGame.lua
+++ b/TitanClassic/TitanGame.lua
@@ -1,6 +1,8 @@
 --[===[ File
 NAME: TitanGame.lua
 DESC: This file contains the 'game version' Titan or TitanClassic. Used to set up libs, locale, ...
+Different folders are required because Titan used TitanClassic as a name (& folder) for the Classic WoW versions.
+The saved variables for Classic WoW are in TitanClassic.lua - not Titan.lua.
 :DESC
 --]===]

diff --git a/TitanClock/TitanClock.lua b/TitanClock/TitanClock.lua
index 28861bb..3cf663a 100644
--- a/TitanClock/TitanClock.lua
+++ b/TitanClock/TitanClock.lua
@@ -33,7 +33,11 @@ local function SetColor(text)
 	return label;
 end

-local function TitanPanelClockButton_GetTime(displaytype, offset)
+---@param displaytype string Server | Local
+---@param offset number User selected offset
+---@return nil
+---@return string formatted_time
+local function FormatTime(displaytype, offset)
 	-- Calculate the hour/minutes considering the offset
 	local hour, minute = GetGameTime();
 	local twentyfour = "";
@@ -103,12 +107,7 @@ local function TitanPanelClockButton_GetTime(displaytype, offset)
 	end
 end

---[[
--- **************************************************************************
--- NAME : GetButtonText()
--- DESC : Display time on button based on set variables
--- **************************************************************************
---]]
+--- local Display time on button based on user settings
 local function GetButtonText()
 	local clocktime = "";
 	local labeltext = "";
@@ -116,17 +115,17 @@ local function GetButtonText()
 	local labeltext2 = nil;
 	local _ = nil
 	if TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "Server" then
-		_, clocktime = TitanPanelClockButton_GetTime("Server", 0)
+		_, clocktime = FormatTime("Server", 0)
 		labeltext = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and SetColor("(S) ") or ""
 	elseif TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "ServerAdjusted" then
-		_, clocktime = TitanPanelClockButton_GetTime("Server", TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"))
+		_, clocktime = FormatTime("Server", TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"))
 		labeltext = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and SetColor("(A) ") or ""
 	elseif TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "Local" then
-		_, clocktime = TitanPanelClockButton_GetTime("Local", 0)
+		_, clocktime = FormatTime("Local", 0)
 		labeltext = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and SetColor("(L) ") or ""
 	elseif TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "ServerLocal" then
-		local _, s = TitanPanelClockButton_GetTime("Server", 0)
-		local _, l = TitanPanelClockButton_GetTime("Local", 0)
+		local _, s = FormatTime("Server", 0)
+		local _, l = FormatTime("Local", 0)
 		local sl = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and SetColor("(S) ") or ""
 		local ll = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and SetColor("(L) ") or ""
 		clocktime = s
@@ -134,8 +133,8 @@ local function GetButtonText()
 		clocktime2 = l
 		labeltext2 = ll
 	elseif TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "ServerAdjustedLocal" then
-		local _, s = TitanPanelClockButton_GetTime("Server", TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"))
-		local _, l = TitanPanelClockButton_GetTime("Local", 0)
+		local _, s = FormatTime("Server", TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"))
+		local _, l = FormatTime("Local", 0)
 		local sl = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and SetColor("(A) ") or ""
 		local ll = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and SetColor("(L) ") or ""
 		clocktime = s
@@ -143,20 +142,15 @@ local function GetButtonText()
 		clocktime2 = l
 		labeltext2 = ll
 	elseif TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "Local" then
-		_, clocktime = TitanPanelClockButton_GetTime("Local", 0)
+		_, clocktime = FormatTime("Local", 0)
 		labeltext = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and SetColor("(L) ") or ""
 	end
 	return labeltext, clocktime, labeltext2, clocktime2
 end

---[[
--- **************************************************************************
--- NAME : TitanPanelClock_GetOffsetText(offset)
--- DESC : Get hour offset value and return
--- VARS : offset = hour offset from server time
--- **************************************************************************
---]]
-local function TitanPanelClock_GetOffsetText(offset)
+---@param offset number User selected offset
+---@return string formatted_offset
+local function GetOffsetText(offset)
 	if (offset > 0) then
 		return TitanUtils_GetGreenText("+" .. tostring(offset));
 	elseif (offset < 0) then
@@ -166,16 +160,12 @@ local function TitanPanelClock_GetOffsetText(offset)
 	end
 end

---[[
--- **************************************************************************
--- NAME : GetTooltipText()
--- DESC : Display tooltip text
--- **************************************************************************
---]]
+---local Return the tool tip text based on user settings
+---@return string formatted_text
 local function GetTooltipText()
-	local _, clockTimeLocal = TitanPanelClockButton_GetTime("Local", 0)
-	local _, clockTimeServer = TitanPanelClockButton_GetTime("Server", 0)
-	local _, clockTimeServerAdjusted = TitanPanelClockButton_GetTime("Server", TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"))
+	local _, clockTimeLocal = FormatTime("Local", 0)
+	local _, clockTimeServer = FormatTime("Server", 0)
+	local _, clockTimeServerAdjusted = FormatTime("Server", TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"))
 	local clockTimeLocalLabel = L["TITAN_CLOCK_TOOLTIP_LOCAL_TIME"] .. "\t" ..
 	TitanUtils_GetHighlightText(clockTimeLocal)
 	local clockTimeServerLabel = L["TITAN_CLOCK_TOOLTIP_SERVER_TIME"] ..
@@ -185,7 +175,7 @@ local function GetTooltipText()
 		clockTimeServerAdjustedLabel = L["TITAN_CLOCK_TOOLTIP_SERVER_ADJUSTED_TIME"] ..
 		"\t" .. TitanUtils_GetHighlightText(clockTimeServerAdjusted) .. "\n"
 	end
-	local clockText = TitanPanelClock_GetOffsetText(TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"));
+	local clockText = GetOffsetText(TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"));
 	return "" ..
 		clockTimeLocalLabel .. "\n" ..
 		clockTimeServerLabel .. "\n" ..
@@ -220,12 +210,7 @@ local function ToggleMapTime()
 	end
 end

---[[
--- **************************************************************************
--- NAME : CreateMenu()
--- DESC : Generate clock right click menu options
--- **************************************************************************
---]]
+---local Build the right click menu
 local function CreateMenu()
 	TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_CLOCK_ID].menuText);

@@ -316,12 +301,8 @@ local function CreateMenu()
 	TitanPanelRightClickMenu_AddControlVars(TITAN_CLOCK_ID)
 end

---[[
--- **************************************************************************
--- NAME : OnLoad()
--- DESC : Registers the plugin upon it loading
--- **************************************************************************
---]]
+---local Build the plugin .registry and register events
+---@param self Button plugin frame
 local function OnLoad(self)
 	local notes = ""
 		.. "Adds a clock to Titan Panel.\n"
@@ -357,12 +338,8 @@ local function OnLoad(self)
 	self:RegisterEvent("PLAYER_ENTERING_WORLD");
 end

---[[
--- **************************************************************************
--- NAME : OnShow()
--- DESC : Create repeating timer when plugin is visible
--- **************************************************************************
---]]
+---local Start the timer for advancing the clock time
+---@param self Button plugin frame
 local function OnShow(self)
 	if ClockTimerRunning then
 		-- Do not create a new one
@@ -372,17 +349,17 @@ local function OnShow(self)
 	end
 end

---[[
--- **************************************************************************
--- NAME : OnHide()
--- DESC : Destroy repeating timer when plugin is hidden
--- **************************************************************************
---]]
+---local Stop the timer for advancing the clock time
+---@param self Button plugin frame
 local function OnHide(self)
 	AceTimer:CancelTimer(ClockTimer)
 	ClockTimerRunning = false
 end

+---local Handle events the clock plugin is interested in.
+---@param self Button plugin frame
+---@param event string Event
+---@param ... any Event parameters
 local function OnEvent(self, event, ...)
 	if (event == "PLAYER_ENTERING_WORLD") then
 		-- If the user wants the minimap clock or calendar hidden then hide them
@@ -399,6 +376,9 @@ local function OnEvent(self, event, ...)
 	end
 end

+---local Handle mouse events the clock plugin is interested in.
+---@param self Button plugin frame
+---@param button string Button pushed with any modifiers
 local function OnClick(self, button)
 	if button == "LeftButton" and IsShiftKeyDown() then
 		TitanUtils_CloseAllControlFrames();
@@ -412,40 +392,35 @@ local function OnClick(self, button)
 	end
 end

---[[
--- **************************************************************************
--- NAME : Slider_OnEnter()
--- DESC : Display slider tooltip
--- **************************************************************************
---]]
-local function Slider_OnEnter(self)
-	self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_CLOCK_CONTROL_TOOLTIP"],
-		TitanPanelClock_GetOffsetText(TitanGetVar(TITAN_CLOCK_ID, "OffsetHour")));
+-- === Slider routines
+
+---local Generate slider tooltip.
+---@param self Slider plugin slider frame
+local function Slider_GetTooltip(self)
+	local slider_tooltip = TitanOptionSlider_TooltipText(L["TITAN_CLOCK_CONTROL_TOOLTIP"],
+		GetOffsetText(TitanGetVar(TITAN_CLOCK_ID, "OffsetHour")));
 	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
-	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
+	GameTooltip:SetText(slider_tooltip, nil, nil, nil, nil, 1);
+end
+
+---local Display slider tooltip on mouse over.
+---@param self Slider plugin slider frame
+local function Slider_OnEnter(self)
+	Slider_GetTooltip(self)
 	TitanUtils_StopFrameCounting(self:GetParent());
 end

---[[
--- **************************************************************************
--- NAME : Slider_OnLeave()
--- DESC : Hide slider tooltip
--- **************************************************************************
---]]
+---local Remove slider tooltip on mouse over leaving.
+---@param self Slider plugin slider frame
 local function Slider_OnLeave(self)
-	self.tooltipText = nil;
 	GameTooltip:Hide();
 	TitanUtils_StartFrameCounting(self:GetParent(), TITAN_CLOCK_FRAME_SHOW_TIME);
 end

---[[
--- **************************************************************************
--- NAME : Slider_OnShow()
--- DESC : Display slider tooltip options
--- **************************************************************************
---]]
+---local Display slider tooltip options
+---@param self Slider plugin slider frame
 local function Slider_OnShow(self)
-	_G[self:GetName() .. "Text"]:SetText(TitanPanelClock_GetOffsetText(TitanGetVar(TITAN_CLOCK_ID, "OffsetHour")));
+	_G[self:GetName() .. "Text"]:SetText(GetOffsetText(TitanGetVar(TITAN_CLOCK_ID, "OffsetHour")));
 	_G[self:GetName() .. "High"]:SetText(L["TITAN_CLOCK_CONTROL_LOW"]);
 	_G[self:GetName() .. "Low"]:SetText(L["TITAN_CLOCK_CONTROL_HIGH"]);
 	--	self:SetThumbTexture("Interface\Buttons\UI-SliderBar-Button-Vertical")
@@ -455,15 +430,11 @@ local function Slider_OnShow(self)
 	self:SetValue(0 - TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"));
 end

---[[
--- **************************************************************************
--- NAME : Slider_OnValueChanged(arg1)
--- DESC : Display slider tooltip text
--- VARS : arg1 = positive or negative change to apply
--- **************************************************************************
---]]
+---local Display slider tooltip text
+---@param self Slider plugin slider frame
+---@param a1 number positive or negative change to apply
 local function Slider_OnValueChangedWheel(self, a1)
-	_G[self:GetName() .. "Text"]:SetText(TitanPanelClock_GetOffsetText(0 - self:GetValue()));
+	_G[self:GetName() .. "Text"]:SetText(GetOffsetText(0 - self:GetValue()));
 	local tempval = self:GetValue();

 	if a1 == -1 then
@@ -481,17 +452,16 @@ local function Slider_OnValueChangedWheel(self, a1)
 	TitanPanelButton_UpdateButton(TITAN_CLOCK_ID);

 	-- Update GameTooltip
-	if (self.tooltipText) then
-		self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_CLOCK_CONTROL_TOOLTIP"],
-			TitanPanelClock_GetOffsetText(TitanGetVar(TITAN_CLOCK_ID, "OffsetHour")));
-		GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	end
+	Slider_GetTooltip(self)
 end


+---local Display slider tooltip text
+---@param self Slider plugin slider frame
+---@param a1 number positive or negative change to apply
 local function Slider_OnValueChanged(self, a1)
 	local step = self:GetValue()
-	_G[self:GetName() .. "Text"]:SetText(TitanPanelClock_GetOffsetText(0 - step));
+	_G[self:GetName() .. "Text"]:SetText(GetOffsetText(0 - step));
 	TitanSetVar(TITAN_CLOCK_ID, "OffsetHour", 0 - step);
 	if (ServerTimeOffsets[realmName]) then
 		ServerTimeOffsets[realmName] = TitanGetVar(TITAN_CLOCK_ID, "OffsetHour");
@@ -499,19 +469,13 @@ local function Slider_OnValueChanged(self, a1)
 	TitanPanelButton_UpdateButton(TITAN_CLOCK_ID);

 	-- Update GameTooltip
-	if (self.tooltipText) then
-		self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_CLOCK_CONTROL_TOOLTIP"],
-			TitanPanelClock_GetOffsetText(TitanGetVar(TITAN_CLOCK_ID, "OffsetHour")));
-		GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	end
+	Slider_GetTooltip(self)
 end

---[[
--- **************************************************************************
--- NAME : TitanPanelClockControlFrame_OnLoad()
--- DESC : Create clock option frame
--- **************************************************************************
---]]
+-- === Option menu routines
+
+---local Create clock option frame
+---@param self Frame Plugin option menu frame
 local function TitanPanelClockControlFrame_OnLoad(self)
 	_G[self:GetName() .. "Title"]:SetText(L["TITAN_CLOCK_CONTROL_TITLE"]);
 	--[[
@@ -524,13 +488,9 @@ and set the values in the code (Lua)
 	TitanPanelRightClickMenu_SetCustomBackdrop(self)
 end

---[[
--- **************************************************************************
--- NAME : Control_OnUpdate(elapsed)
--- DESC : If dropdown is visible, see if its timer has expired.  If so, hide frame
--- VARS : elapsed = <research>
--- **************************************************************************
---]]
+---If dropdown is visible, see if its timer has expired.  If expired, hide frame.
+---@param self Frame Plugin option menu frame
+---@param elapsed number portion of second since last OnUpdate
 local function Control_OnUpdate(self, elapsed)
 	TitanUtils_CheckFrameCounting(self, elapsed);
 end
diff --git a/TitanGold/TitanGold.lua b/TitanGold/TitanGold.lua
index 1bd6576..df7de43 100644
--- a/TitanGold/TitanGold.lua
+++ b/TitanGold/TitanGold.lua
@@ -9,14 +9,14 @@

 -- ******************************** Constants *******************************
 local TITAN_GOLD_ID = "Gold";
-local TITAN_BUTTON = "TitanPanel"..TITAN_GOLD_ID.."Button"
+local TITAN_BUTTON = "TitanPanel" .. TITAN_GOLD_ID .. "Button"
 local TITAN_GOLD_COUNT_FORMAT = "%d";
 local TITAN_GOLD_VERSION = TITAN_VERSION;
 local TITAN_GOLD_SPACERBAR = "-----------------------";
-local TITAN_GOLD_BLUE = {r=0.4,b=1,g=0.4};
-local TITAN_GOLD_RED = {r=1,b=0,g=0};
-local TITAN_GOLD_GREEN = {r=0,b=0,g=1};
-local updateTable = {TITAN_GOLD_ID, TITAN_PANEL_UPDATE_TOOLTIP };
+local TITAN_GOLD_BLUE = { r = 0.4, b = 1, g = 0.4 };
+local TITAN_GOLD_RED = { r = 1, b = 0, g = 0 };
+local TITAN_GOLD_GREEN = { r = 0, b = 0, g = 1 };
+local updateTable = { TITAN_GOLD_ID, TITAN_PANEL_UPDATE_TOOLTIP };

 -- ******************************** Variables *******************************
 local GOLD_INITIALIZED = false;
@@ -45,31 +45,42 @@ local FACTION_HORDE = "Horde_debug"
 --]]
 -- ******************************** Functions *******************************

+---local Break apart Gold index <character>_<server>::<faction>
+---@param info string
+---@return string
+---@return string
+---@return string
 local function GetIndexInfo(info)
 	local character, charserver, char_faction = string.match(info, '(.*)_(.*)::(.*)')
 	return character, charserver, char_faction
 end

---[[
-Add commas or period in the value given as needed
---]]
+---local Based on user option, add comma or period in the value given, as needed
+---@param amount number
+---@return string
 local function comma_value(amount)
-	local formatted = amount
+	local formatted = tostring(amount)
 	local k
 	local sep = (TitanGetVar(TITAN_GOLD_ID, "UseSeperatorComma") and "UseComma" or "UsePeriod")
 	while true do
 		if sep == "UseComma" then formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') end
 		if sep == "UsePeriod" then formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1.%2') end
-		if (k==0) then
+		if (k == 0) then
 			break
 		end
 	end
 	return formatted
 end

---[[
-Take the 'amount' of gold and make it into a nice, colorful string of g s c (gold silver copper)
---]]
+---local Take the total cash and make it into a nice, colorful string of g s c (gold silver copper)
+---@param value number
+---@param show_zero boolean
+---@param show_neg boolean
+---@return string outstr Formatted cash for output
+---@return number cash Value as passed in
+---@return integer gold part of value
+---@return integer silver part of value
+---@return integer copper part of value
 local function NiceCash(value, show_zero, show_neg)
 	local neg1 = ""
 	local neg2 = ""
@@ -89,10 +100,10 @@ local function NiceCash(value, show_zero, show_neg)
 	local cash = (amount or 0)
 	local font_size = TitanPanelGetVar("FontSize")
 	local icon_pre = "|TInterface\\MoneyFrame\\"
-	local icon_post = ":"..font_size..":"..font_size..":2:0|t"
-	local g_icon = icon_pre.."UI-GoldIcon"..icon_post
-	local s_icon = icon_pre.."UI-SilverIcon"..icon_post
-	local c_icon = icon_pre.."UI-CopperIcon"..icon_post
+	local icon_post = ":" .. font_size .. ":" .. font_size .. ":2:0|t"
+	local g_icon = icon_pre .. "UI-GoldIcon" .. icon_post
+	local s_icon = icon_pre .. "UI-SilverIcon" .. icon_post
+	local c_icon = icon_pre .. "UI-CopperIcon" .. icon_post
 	-- build the coin label strings based on the user selections
 	local show_labels = TitanGetVar(TITAN_GOLD_ID, "ShowCoinLabels")
 	local show_icons = TitanGetVar(TITAN_GOLD_ID, "ShowCoinIcons")
@@ -113,8 +124,8 @@ local function NiceCash(value, show_zero, show_neg)

 	if show_neg then
 		if amount < 0 then
-			neg1 = "|cFFFF6600" .."("..FONT_COLOR_CODE_CLOSE
-			neg2 = "|cFFFF6600" ..")"..FONT_COLOR_CODE_CLOSE
+			neg1 = "|cFFFF6600" .. "(" .. FONT_COLOR_CODE_CLOSE
+			neg2 = "|cFFFF6600" .. ")" .. FONT_COLOR_CODE_CLOSE
 		else
 			neg2 = " " -- need to pad for other negative numbers
 		end
@@ -125,7 +136,7 @@ local function NiceCash(value, show_zero, show_neg)

 	if amount == 0 then
 		if show_zero then
-			copper_str = cc..(amount or "?")..c_lab..""..FONT_COLOR_CODE_CLOSE
+			copper_str = cc .. (amount or "?") .. c_lab .. "" .. FONT_COLOR_CODE_CLOSE
 		end
 	elseif amount > 0 then
 		-- figure out the gold - silver - copper components
@@ -135,14 +146,14 @@ local function NiceCash(value, show_zero, show_neg)
 		copper = amount - (silver * asilver)
 		-- now make the coin strings
 		if gold > 0 then
-			gold_str = gc..(comma_value(gold) or "?")..g_lab.." "..FONT_COLOR_CODE_CLOSE
-			silver_str = sc..(string.format("%02d", silver) or "?")..s_lab.." "..FONT_COLOR_CODE_CLOSE
-			copper_str = cc..(string.format("%02d", copper) or "?")..c_lab..""..FONT_COLOR_CODE_CLOSE
+			gold_str = gc .. (comma_value(gold) or "?") .. g_lab .. " " .. FONT_COLOR_CODE_CLOSE
+			silver_str = sc .. (string.format("%02d", silver) or "?") .. s_lab .. " " .. FONT_COLOR_CODE_CLOSE
+			copper_str = cc .. (string.format("%02d", copper) or "?") .. c_lab .. "" .. FONT_COLOR_CODE_CLOSE
 		elseif (silver > 0) then
-			silver_str = sc..(silver or "?")..s_lab.." "..FONT_COLOR_CODE_CLOSE
-			copper_str = cc..(string.format("%02d", copper) or "?")..c_lab..""..FONT_COLOR_CODE_CLOSE
+			silver_str = sc .. (silver or "?") .. s_lab .. " " .. FONT_COLOR_CODE_CLOSE
+			copper_str = cc .. (string.format("%02d", copper) or "?") .. c_lab .. "" .. FONT_COLOR_CODE_CLOSE
 		elseif (copper > 0) then
-			copper_str = cc..(copper or "?")..c_lab..""..FONT_COLOR_CODE_CLOSE
+			copper_str = cc .. (copper or "?") .. c_lab .. "" .. FONT_COLOR_CODE_CLOSE
 		end
 	end

@@ -152,19 +163,19 @@ local function NiceCash(value, show_zero, show_neg)
 		-- special case for those who want to show only gold
 		if gold == 0 then
 			if show_zero then
-				gold_str = gc.."0"..g_lab.." "..FONT_COLOR_CODE_CLOSE
+				gold_str = gc .. "0" .. g_lab .. " " .. FONT_COLOR_CODE_CLOSE
 			end
 		end
 	end

 	-- build the return string
 	outstr = outstr
-		..neg1
-		..gold_str
-		..silver_str
-		..copper_str
-		..neg2
---[[
+		.. neg1
+		.. gold_str
+		.. silver_str
+		.. copper_str
+		.. neg2
+	--[[
 SC.Print("Acc cash:"
 ..(gold or "?").."g "
 ..(silver or "?").."s "
@@ -175,24 +186,24 @@ SC.Print("Acc cash:"
 	return outstr, cash, gold, silver, copper
 end

+---local Create Show menu - list of characters in same faction
+---@param faction string
 local function ShowMenuButtons(faction)
 	local info = {};
-	local name = GetUnitName("player");
-	local server = realmName;
 	for index, money in pairs(GoldSave) do
 		local character, charserver, char_faction = GetIndexInfo(index) --string.match(index, "(.*)_(.*)::"..faction);
-		if character
-		and (char_faction == faction)
+		if character
+			and (char_faction == faction)
 		then
-			info.text = character.." - "..charserver;
+			info.text = character .. " - " .. charserver;
 			info.value = character;
 			info.keepShownOnClick = true;
 			info.checked = function()
-				local rementry = character.."_"..charserver.."::"..faction;
+				local rementry = character .. "_" .. charserver .. "::" .. faction;
 				return GoldSave[rementry].show
 			end
 			info.func = function()
-				local rementry = character.."_"..charserver.."::"..faction;
+				local rementry = character .. "_" .. charserver .. "::" .. faction;
 				GoldSave[rementry].show = not GoldSave[rementry].show;
 				TitanPanelButton_UpdateButton(TITAN_GOLD_ID)
 			end
@@ -201,6 +212,8 @@ local function ShowMenuButtons(faction)
 	end
 end

+---local Create Delete menu - list of characters in same faction
+---@param faction string
 local function DeleteMenuButtons(faction)
 	local info = {};
 	local name = GetUnitName("player");
@@ -208,13 +221,13 @@ local function DeleteMenuButtons(faction)
 	for index, money in pairs(GoldSave) do
 		local character, charserver, char_faction = GetIndexInfo(index) --string.match(index, "(.*)_(.*)::"..faction);
 		info.notCheckable = true
-		if character
-		and (char_faction == faction)
+		if character
+			and (char_faction == faction)
 		then
-			info.text = character.." - "..charserver;
+			info.text = character .. " - " .. charserver;
 			info.value = character;
 			info.func = function()
-				local rementry = character.."_"..charserver.."::"..faction;
+				local rementry = character .. "_" .. charserver .. "::" .. faction;
 				GoldSave[rementry] = nil;
 				TitanPanelButton_UpdateButton(TITAN_GOLD_ID)
 			end
@@ -229,6 +242,8 @@ local function DeleteMenuButtons(faction)
 	end
 end

+---local Based on user Coin selection set None | Labels | Icons
+---@param chosen string
 local function ShowProperLabels(chosen)
 	if chosen == "ShowCoinNone" then
 		TitanSetVar(TITAN_GOLD_ID, "ShowCoinNone", true);
@@ -248,6 +263,8 @@ local function ShowProperLabels(chosen)
 	TitanPanelButton_UpdateButton(TITAN_GOLD_ID);
 end

+---local Based on user Seperator selection set Comma | Period
+---@param chosen string
 local function Seperator(chosen)
 	if chosen == "UseSeperatorComma" then
 		TitanSetVar(TITAN_GOLD_ID, "UseSeperatorComma", true);
@@ -260,6 +277,8 @@ local function Seperator(chosen)
 	TitanPanelButton_UpdateButton(TITAN_GOLD_ID);
 end

+---local Based on user Server selection set Merge | Seperate | All
+---@param chosen string
 local function Merger(chosen)
 	if chosen == "MergeServers" then
 		TitanSetVar(TITAN_GOLD_ID, "MergeServers", true);
@@ -279,13 +298,8 @@ local function Merger(chosen)
 	TitanPanelButton_UpdateButton(TITAN_GOLD_ID);
 end

---[[
--- *******************************************************************************************
--- NAME: TitanPanelGoldGPH_Toggle()
--- DESC: This toggles if the player wants to see the gold/hour stats
--- *******************************************************************************************
---]]
-function TitanPanelGoldGPH_Toggle()
+---local Toggles when the player selects the show gold/hour stats
+local function GoldGPH_Toggle()
 	TitanToggleVar(TITAN_GOLD_ID, "DisplayGoldPerHour")

 	if TitanGetVar(TITAN_GOLD_ID, "DisplayGoldPerHour") then
@@ -301,157 +315,22 @@ function TitanPanelGoldGPH_Toggle()
 	end
 end

-local function DisplayOptions()
-
-	local info = {};
-	info.notCheckable = true
-	info.text = L["TITAN_GOLD_SORT_BY"];
-	info.value = "Sorting";
-	info.hasArrow = 1;
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
-
-	-- Which characters to show
-	--  - Separate : this server
-	--  - Merge : connected / merged servers
-	--  - All : any server
-	local info = {};
-	info.text = L["TITAN_GOLD_SEPARATE"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "SeparateServers");
-	info.func = function()
-		Merger("SeparateServers")
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	local info = {};
-	info.text = L["TITAN_GOLD_MERGE"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "MergeServers");
-	info.func = function()
-		Merger("MergeServers")
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	local info = {};
-	info.text = L["TITAN_GOLD_ALL"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "AllServers");
-	info.func = function()
-		Merger("AllServers")
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
-
-	-- Option to ignore faction - per 9.2.5 changes
-	local info = {};
-	info.text = L["TITAN_GOLD_IGNORE_FACTION"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "IgnoreFaction");
-	info.func = function()
-		TitanToggleVar(TITAN_GOLD_ID, "IgnoreFaction");
-		TitanPanelButton_UpdateButton(TITAN_GOLD_ID);
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
-
-	-- What labels to show next to money none / text / icon
-	local info = {};
-	info.text = L["TITAN_GOLD_COIN_NONE"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "ShowCoinNone");
-	info.func = function()
-		ShowProperLabels("ShowCoinNone")
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	local info = {};
-	info.text = L["TITAN_GOLD_COIN_LABELS"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "ShowCoinLabels");
-	info.func = function()
-		ShowProperLabels("ShowCoinLabels")
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	local info = {};
-	info.text = L["TITAN_GOLD_COIN_ICONS"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "ShowCoinIcons");
-	info.func = function()
-		ShowProperLabels("ShowCoinIcons")
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
-
-	-- Show gold only option - no silver, no copper
-	info = {};
-	info.text = L["TITAN_GOLD_ONLY"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "ShowGoldOnly");
-	info.func = function()
-		TitanToggleVar(TITAN_GOLD_ID, "ShowGoldOnly");
-		TitanPanelButton_UpdateButton(TITAN_GOLD_ID);
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
-
-	-- Use comma or period as separater on gold
-	local info = {};
-	info.text = L["TITAN_PANEL_USE_COMMA"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "UseSeperatorComma");
-	info.func = function()
-		Seperator("UseSeperatorComma")
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	local info = {};
-	info.text = L["TITAN_PANEL_USE_PERIOD"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "UseSeperatorPeriod");
-	info.func = function()
-		Seperator("UseSeperatorPeriod")
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
-
-	-- Show session info
-	info = {};
-	info.text = L["TITAN_GOLD_SHOW_STATS_TITLE"];
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "ShowSessionInfo");
-	info.func = function()
-		TitanToggleVar(TITAN_GOLD_ID, "ShowSessionInfo");
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
-
-	-- Function to toggle gold per hour sort
-	info = {};
-	info.text = L["TITAN_GOLD_TOGGLE_GPH_SHOW"]
-	info.checked = TitanGetVar(TITAN_GOLD_ID, "DisplayGoldPerHour");
-	info.func = function()
-		TitanPanelGoldGPH_Toggle()
-	end
-	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
-end
-
+---local Helper for TotalGold
+--- If toon is to be shown add amount to total; otherwise pass back running total
 local function ToonAdd(show, amount, total)
 	local new_total = 0
-
+
 	if show then
 		new_total = total + amount
 	else
 		new_total = total
 	end
-
+
 	return new_total
 end

---[[
--- *******************************************************************************************
--- NAME: TotalGold()
--- DESC: Calculates total gold for display per user selections
--- *******************************************************************************************
---]]
+---local Calculates total gold for display per user selections
+---@return integer
 local function TotalGold()
 	local ttlgold = 0;
 	local cnt = 0;
@@ -461,9 +340,9 @@ local function TotalGold()
 	local character, charserver = "", ""
 	local char_faction = ""
 	local ignore_faction = TitanGetVar(TITAN_GOLD_ID, "IgnoreFaction")
-
-	for _ in pairs (realmNames) do
-		countelements = countelements + 1
+
+	for _ in pairs(realmNames) do
+		countelements = countelements + 1
 	end

 	if TitanGetVar(TITAN_GOLD_ID, "SeparateServers") then
@@ -489,7 +368,7 @@ local function TotalGold()

 			for index, money in pairs(GoldSave) do
 				character, charserver, char_faction = GetIndexInfo(index)
-				-- GetAutoCompleteRealms removes spaces, idk why...
+				-- GetAutoCompleteRealms removes spaces, idk why...
 				if (charserver) then
 					charserver = string.gsub(charserver, "%s", "");
 				end
@@ -527,32 +406,29 @@ local function TotalGold()
 end

 -- ====== Tool tip routines
+
 local function GetToonInfo(info)
 	return info.name, info.realm, info.faction
 end

---[[
--- *******************************************************************************************
--- NAME: GetTooltipText()
--- DESC: Gets the tool-tip text, what appears when we hover over Gold on the Titan bar.
--- *******************************************************************************************
---]]
+---local Generate formatted tooltip text
+---@return string
 local function GetTooltipText()
 	local GoldSaveSorted = {};
 	local currentMoneyRichText = "";
 	local countelements = 0;
 	local faction, faction_locale = UnitFactionGroup("Player") -- get localized faction
 	local ignore_faction = TitanGetVar(TITAN_GOLD_ID, "IgnoreFaction")
-
-	for _ in pairs (realmNames) do
-		countelements = countelements + 1
+
+	for _ in pairs(realmNames) do
+		countelements = countelements + 1
 	end

---	if countelements == 0 or TitanGetVar(TITAN_GOLD_ID, "SeparateServers") then
+	--	if countelements == 0 or TitanGetVar(TITAN_GOLD_ID, "SeparateServers") then
 	-- The check for no connected realms was confusing so use the 'merge' format
 	-- if requested.
 	-- insert all keys from hash into the GoldSaveSorted array
-
+
 	if TitanGetVar(TITAN_GOLD_ID, "SeparateServers") then
 		-- Parse the database and display characters from this server
 		GoldSave[GOLD_INDEX].gold = GetMoney()
@@ -581,7 +457,7 @@ local function GetTooltipText()

 			for index, money in pairs(GoldSave) do
 				character, charserver, char_faction = GetIndexInfo(index)
-				-- GetAutoCompleteRealms removes spaces, idk why...
+				-- GetAutoCompleteRealms removes spaces, idk why...
 				if (charserver) then
 					charserver = string.gsub(charserver, "%s", "");
 				end
@@ -620,25 +496,25 @@ local function GetTooltipText()
 	-- * by name or by gold amount descending
 	-- * grouping by realm if selected
 	if TitanGetVar(TITAN_GOLD_ID, "SortByName") then
-		table.sort(GoldSaveSorted, function (key1, key2)
+		table.sort(GoldSaveSorted, function(key1, key2)
 			if by_realm then
 				if GoldSave[key1].realm ~= GoldSave[key2].realm then
 					return GoldSave[key1].realm < GoldSave[key2].realm
 				end
 			end

-			return GoldSave[key1].name < GoldSave[key2].name
-			end)
+			return GoldSave[key1].name < GoldSave[key2].name
+		end)
 	else
-		table.sort(GoldSaveSorted, function (key1, key2)
+		table.sort(GoldSaveSorted, function(key1, key2)
 			if by_realm then
 				if GoldSave[key1].realm ~= GoldSave[key2].realm then
 					return GoldSave[key1].realm < GoldSave[key2].realm
 				end
 			end

-			return GoldSave[key1].gold > GoldSave[key2].gold
-			end)
+			return GoldSave[key1].gold > GoldSave[key2].gold
+		end)
 	end

 	-- Array holds all characters to display, nicely sorted.
@@ -656,11 +532,11 @@ local function GetTooltipText()
 		show_realm = true

 		if (TitanGetVar(TITAN_GOLD_ID, "SeparateServers")) then
---			charserver = ""  -- do not repeat the server on each line
+			--			charserver = ""  -- do not repeat the server on each line
 			show_realm = false
 		elseif (TitanGetVar(TITAN_GOLD_ID, "MergeServers")) then
 			show_dash = true
---			charserver = "-"..charserver
+			--			charserver = "-"..charserver
 		elseif (TitanGetVar(TITAN_GOLD_ID, "AllServers")) then
 			show_dash = true
 		end
@@ -668,34 +544,32 @@ local function GetTooltipText()
 		if by_realm then
 			-- Set a realm header
 			if charserver ~= curr_realm then
-				currentMoneyRichText = currentMoneyRichText.."\n"
-					.."-- "..charserver
+				currentMoneyRichText = currentMoneyRichText .. "\n"
+					.. "-- " .. charserver
 				curr_realm = charserver
 			end
 			show_dash = false
---			charserver = ""  -- do not repeat the server on each line
+			--			charserver = ""  -- do not repeat the server on each line
 			show_realm = false
 		end

 		if ignore_faction then
 			if char_faction == TITAN_ALLIANCE then
-				faction_text = "-".."|cff5b92e5"
-							..GoldSave[GoldSaveSorted[i]].faction
-							.._G["FONT_COLOR_CODE_CLOSE"]
+				faction_text = TitanUtils_GetHexText(GoldSave[GoldSaveSorted[i]].faction, Titan_Global.colors.alliance)
 			elseif char_faction == TITAN_HORDE then
-				faction_text = "-"..TitanUtils_GetHexText(GoldSave[GoldSaveSorted[i]].faction, "d42447")
+				faction_text = "-" .. TitanUtils_GetHexText(GoldSave[GoldSaveSorted[i]].faction, Titan_Global.colors.horde)
 			end
 		end
-
-		currentMoneyRichText = currentMoneyRichText.."\n"
-			..character
-			..(show_dash and "-" or "")
-			..(show_realm and charserver or "")
-			..faction_text
-			.."\t"..coin_str
+
+		currentMoneyRichText = currentMoneyRichText .. "\n"
+			.. character
+			.. (show_dash and "-" or "")
+			.. (show_realm and charserver or "")
+			.. faction_text
+			.. "\t" .. coin_str
 	end

---[[
+	--[[
 print("TG"
 .." "..tostring(counter)
 .." "..tostring(x0)
@@ -712,9 +586,9 @@ print("TG"
 	coin_str = ""
 	-- Display total gold
 	coin_str = NiceCash(TotalGold(), false, false)
-	currentMoneyRichText = currentMoneyRichText.."\n"
-		..TITAN_GOLD_SPACERBAR.."\n"
-		..L["TITAN_GOLD_TTL_GOLD"].."\t"..coin_str
+	currentMoneyRichText = currentMoneyRichText .. "\n"
+		.. TITAN_GOLD_SPACERBAR .. "\n"
+		.. L["TITAN_GOLD_TTL_GOLD"] .. "\t" .. coin_str

 	-- find session earnings and earning per hour
 	local sesstotal = GetMoney() - GOLD_STARTINGGOLD;
@@ -728,11 +602,11 @@ print("TG"
 	local perhour = math.floor(sesstotal / sesslength * 3600);

 	coin_str = NiceCash(GOLD_STARTINGGOLD, false, false)
-
+
 	local sessionMoneyRichText = ""
 	if TitanGetVar(TITAN_GOLD_ID, "ShowSessionInfo") then
-		sessionMoneyRichText = "\n\n"..TitanUtils_GetHighlightText(L["TITAN_GOLD_STATS_TITLE"])
-			.."\n"..L["TITAN_GOLD_START_GOLD"].."\t"..coin_str.."\n"
+		sessionMoneyRichText = "\n\n" .. TitanUtils_GetHighlightText(L["TITAN_GOLD_STATS_TITLE"])
+			.. "\n" .. L["TITAN_GOLD_START_GOLD"] .. "\t" .. coin_str .. "\n"

 		if (negative) then
 			GOLD_COLOR = TITAN_GOLD_RED;
@@ -745,22 +619,22 @@ print("TG"
 		end

 		coin_str = NiceCash(sesstotal, true, true)
-	--		..TitanUtils_GetColoredText(GOLD_SESS_STATUS,GOLD_COLOR)
+		--		..TitanUtils_GetColoredText(GOLD_SESS_STATUS,GOLD_COLOR)
 		sessionMoneyRichText = sessionMoneyRichText
-			..TitanUtils_GetColoredText(GOLD_SESS_STATUS,GOLD_COLOR)
-			.."\t"..coin_str.."\n";
+			.. TitanUtils_GetColoredText(GOLD_SESS_STATUS, GOLD_COLOR)
+			.. "\t" .. coin_str .. "\n";

 		if TitanGetVar(TITAN_GOLD_ID, "DisplayGoldPerHour") then
 			coin_str = NiceCash(perhour, true, true)
 			sessionMoneyRichText = sessionMoneyRichText
-				..TitanUtils_GetColoredText(GOLD_PERHOUR_STATUS,GOLD_COLOR)
-				.."\t"..coin_str.."\n";
+				.. TitanUtils_GetColoredText(GOLD_PERHOUR_STATUS, GOLD_COLOR)
+				.. "\t" .. coin_str .. "\n";
 		end
 	else
 		-- Do not display session info
 	end

-	local final_tooltip = TitanUtils_GetGoldText(L["TITAN_GOLD_TOOLTIPTEXT"].." : ")
+	local final_tooltip = TitanUtils_GetGoldText(L["TITAN_GOLD_TOOLTIPTEXT"] .. " : ")

 	local final_server = ""
 	if realmNames == nil or TitanGetVar(TITAN_GOLD_ID, "SeparateServers") then
@@ -770,67 +644,46 @@ print("TG"
 	elseif TitanGetVar(TITAN_GOLD_ID, "AllServers") then
 		final_server = ALL
 	end
-	final_server = TitanUtils_GetGoldText(final_server.." : ")
-
+	final_server = TitanUtils_GetGoldText(final_server .. " : ")
+
 	local final_faction = ""
 	if ignore_faction then
 		final_faction = TitanUtils_GetGoldText(ALL)
 	elseif faction == TITAN_ALLIANCE then
-		final_faction = "|cff5b92e5"..FACTION_ALLIANCE.._G["FONT_COLOR_CODE_CLOSE"]
---		final_faction = TitanUtils_GetGreenText(FACTION_ALLIANCE)
-		-- "|cff0000ff"..text.._G["FONT_COLOR_CODE_CLOSE"]
+		final_faction = TitanUtils_GetHexText(FACTION_ALLIANCE, Titan_Global.colors.alliance)
 	elseif faction == TITAN_HORDE then
-		final_faction = TitanUtils_GetRedText(FACTION_HORDE)
+		final_faction = TitanUtils_GetHexText(FACTION_HORDE, Titan_Global.colors.horde)
 	end
-
+
 	return ""
-		..currentMoneyRichText.."\n"
-		..TITAN_GOLD_SPACERBAR.."\n"
-		..final_tooltip..final_server..final_faction.."\n"
-		..sessionMoneyRichText
+		.. currentMoneyRichText .. "\n"
+		.. TITAN_GOLD_SPACERBAR .. "\n"
+		.. final_tooltip .. final_server .. final_faction .. "\n"
+		.. sessionMoneyRichText
 end
--- ======
+-- ======

 -- ====== Right click menu routines
---[[
--- *******************************************************************************************
--- NAME: ViewAll_Toggle()
--- DESC: This toggles whether or not the player wants to view total gold on the button, or player gold.
--- *******************************************************************************************
---]]
+
+---local Toggle whether button shows player or total gold (based on other user selections).
 local function ViewAll_Toggle()
 	TitanToggleVar(TITAN_GOLD_ID, "ViewAll")
 	TitanPanelButton_UpdateButton(TITAN_GOLD_ID)
 end

---[[
--- *******************************************************************************************
--- NAME: Sort_Toggle()
--- DESC: This toggles how the player wants the display to be sorted - by name or gold amount
--- *******************************************************************************************
---]]
+---local Toggle whether tooltip sorts by toon name or gold amount.
 local function Sort_Toggle()
 	TitanToggleVar(TITAN_GOLD_ID, "SortByName")
 end

---[[
--- *******************************************************************************************
--- NAME: ResetSession()
--- DESC: Resets the current session
--- *******************************************************************************************
---]]
 local function ResetSession()
 	GOLD_STARTINGGOLD = GetMoney();
 	GOLD_SESSIONSTART = GetTime();
 	DEFAULT_CHAT_FRAME:AddMessage(TitanUtils_GetGreenText(L["TITAN_GOLD_SESSION_RESET"]));
 end

---[[
--- **************************************************************************
--- NAME : Initialize_Array()
--- DESC : Build the gold array for the server/faction
--- **************************************************************************
---]]
+---local Build the gold array from saved vars, if any; get current total and session start time
+---@param self Button
 local function Initialize_Array(self)
 	if (GOLD_INITIALIZED) then return; end

@@ -839,22 +692,22 @@ local function Initialize_Array(self)
 	-- See if this is a new to toon to Gold
 	if (GoldSave[GOLD_INDEX] == nil) then
 		GoldSave[GOLD_INDEX] = {}
-		GoldSave[GOLD_INDEX] = {gold = GetMoney(), name = UnitName("player")}
+		GoldSave[GOLD_INDEX] = { gold = GetMoney(), name = UnitName("player") }
 	end
-
+
 	-- Ensure the saved vars are usable
 	for index, money in pairs(GoldSave) do
 		local character, charserver, char_faction = GetIndexInfo(index) --string.match(index, '(.*)_(.*)::(.*)')
-
+
 		-- Could be a new toon to Gold or an updated Gold
 		local show_toon = GoldSave[index].show
 		if show_toon == nil then
 			show_toon = true
 		end
 		GoldSave[index].show = show_toon
-		GoldSave[index].realm = charserver  -- added July 2022
-
-		-- added Aug 2022 for #1332.
+		GoldSave[index].realm = charserver -- added July 2022
+
+		-- added Aug 2022 for #1332.
 		-- Faction in index was not set for display in tool tip.
 		-- Created localized faction as a field; set every time in case user changes languages
 		if char_faction == TITAN_ALLIANCE then
@@ -864,7 +717,7 @@ local function Initialize_Array(self)
 		else
 			GoldSave[index].faction = FACTION_OTHER
 		end
---[[
+		--[[
 		if character == UnitName("player") and charserver == realmName then
 			local rementry = character.."_"..charserver.."::"..UnitFactionGroup("Player");
 			local showCharacter = GoldSave[rementry].show
@@ -881,12 +734,8 @@ local function Initialize_Array(self)
 	TitanPanelButton_UpdateButton(TITAN_GOLD_ID)
 end

---[[
--- **************************************************************************
--- NAME : ClearData()
--- DESC : This will allow the user to clear all the data and rebuild the array
--- **************************************************************************
---]]
+---local Clear the gold array and rebuild
+---@param self Button
 local function ClearData(self)
 	GOLD_INITIALIZED = false;

@@ -896,10 +745,11 @@ local function ClearData(self)
 	DEFAULT_CHAT_FRAME:AddMessage(TitanUtils_GetGreenText(L["TITAN_GOLD_DB_CLEARED"]));
 end

+---local Pops an 'are you sure' when user clicks to reset the gold array
 local function TitanGold_ClearDB()
 	StaticPopupDialogs["TITANGOLD_CLEAR_DATABASE"] = {
-		text = TitanUtils_GetNormalText(L["TITAN_PANEL_MENU_TITLE"].." "
-			..L["TITAN_GOLD_MENU_TEXT"]).."\n\n"..L["TITAN_GOLD_CLEAR_DATA_WARNING"],
+		text = TitanUtils_GetNormalText(L["TITAN_PANEL_MENU_TITLE"] .. " "
+			.. L["TITAN_GOLD_MENU_TEXT"]) .. "\n\n" .. L["TITAN_GOLD_CLEAR_DATA_WARNING"],
 		button1 = ACCEPT,
 		button2 = CANCEL,
 		OnAccept = function(self)
@@ -914,12 +764,140 @@ local function TitanGold_ClearDB()
 	StaticPopup_Show("TITANGOLD_CLEAR_DATABASE");
 end

---[[
--- *******************************************************************************************
--- NAME: CreateMenu
--- DESC: Builds the right click config menu
--- *******************************************************************************************
---]]
+
+---local Generate the tooltip display option menu
+local function DisplayOptions()
+	local info = {};
+	info.notCheckable = true
+	info.text = L["TITAN_GOLD_SORT_BY"];
+	info.value = "Sorting";
+	info.hasArrow = 1;
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
+
+	-- Which characters to show
+	--  - Separate : this server
+	--  - Merge : connected / merged servers
+	--  - All : any server
+	info = {};
+	info.text = L["TITAN_GOLD_SEPARATE"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "SeparateServers");
+	info.func = function()
+		Merger("SeparateServers")
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	info = {};
+	info.text = L["TITAN_GOLD_MERGE"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "MergeServers");
+	info.func = function()
+		Merger("MergeServers")
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	info = {};
+	info.text = L["TITAN_GOLD_ALL"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "AllServers");
+	info.func = function()
+		Merger("AllServers")
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
+
+	-- Option to ignore faction - per 9.2.5 changes
+	info = {};
+	info.text = L["TITAN_GOLD_IGNORE_FACTION"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "IgnoreFaction");
+	info.func = function()
+		TitanToggleVar(TITAN_GOLD_ID, "IgnoreFaction");
+		TitanPanelButton_UpdateButton(TITAN_GOLD_ID);
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
+
+	-- What labels to show next to money none / text / icon
+	info = {};
+	info.text = L["TITAN_GOLD_COIN_NONE"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "ShowCoinNone");
+	info.func = function()
+		ShowProperLabels("ShowCoinNone")
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	info = {};
+	info.text = L["TITAN_GOLD_COIN_LABELS"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "ShowCoinLabels");
+	info.func = function()
+		ShowProperLabels("ShowCoinLabels")
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	info = {};
+	info.text = L["TITAN_GOLD_COIN_ICONS"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "ShowCoinIcons");
+	info.func = function()
+		ShowProperLabels("ShowCoinIcons")
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
+
+	-- Show gold only option - no silver, no copper
+	info = {};
+	info.text = L["TITAN_GOLD_ONLY"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "ShowGoldOnly");
+	info.func = function()
+		TitanToggleVar(TITAN_GOLD_ID, "ShowGoldOnly");
+		TitanPanelButton_UpdateButton(TITAN_GOLD_ID);
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
+
+	-- Use comma or period as separater on gold
+	info = {};
+	info.text = L["TITAN_PANEL_USE_COMMA"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "UseSeperatorComma");
+	info.func = function()
+		Seperator("UseSeperatorComma")
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	info = {};
+	info.text = L["TITAN_PANEL_USE_PERIOD"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "UseSeperatorPeriod");
+	info.func = function()
+		Seperator("UseSeperatorPeriod")
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
+
+	-- Show session info
+	info = {};
+	info.text = L["TITAN_GOLD_SHOW_STATS_TITLE"];
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "ShowSessionInfo");
+	info.func = function()
+		TitanToggleVar(TITAN_GOLD_ID, "ShowSessionInfo");
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
+
+	-- Function to toggle gold per hour sort
+	info = {};
+	info.text = L["TITAN_GOLD_TOGGLE_GPH_SHOW"]
+	info.checked = TitanGetVar(TITAN_GOLD_ID, "DisplayGoldPerHour");
+	info.func = function()
+		GoldGPH_Toggle()
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+end
+
+---local Generate the options menu
 local function CreateMenu()
 	if TitanPanelRightClickMenu_GetDropdownLevel() == 1 then
 		-- Menu title
@@ -983,7 +961,7 @@ local function CreateMenu()
 	end

 	-- Second (2nd) level for show / delete | sort by
-	if TitanPanelRightClickMenu_GetDropdownLevel() == 2
+	if TitanPanelRightClickMenu_GetDropdownLevel() == 2
 		and TitanPanelRightClickMenu_GetDropdMenuValue() == "ToonDelete" then
 		local info = {};
 		info.notCheckable = true
@@ -996,7 +974,7 @@ local function CreateMenu()
 		info.value = "DeleteHorde";
 		info.hasArrow = 1;
 		TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-	elseif TitanPanelRightClickMenu_GetDropdownLevel() == 2
+	elseif TitanPanelRightClickMenu_GetDropdownLevel() == 2
 		and TitanPanelRightClickMenu_GetDropdMenuValue() == "ToonShow" then
 		local info = {};
 		info.notCheckable = true
@@ -1037,7 +1015,7 @@ local function CreateMenu()
 			TitanToggleVar(TITAN_GOLD_ID, "GroupByRealm")
 		end
 		TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-	elseif TitanPanelRightClickMenu_GetDropdownLevel() == 2
+	elseif TitanPanelRightClickMenu_GetDropdownLevel() == 2
 		and TitanPanelRightClickMenu_GetDropdMenuValue() == "Display_Options" then
 		DisplayOptions()
 	end
@@ -1054,12 +1032,7 @@ local function CreateMenu()
 	end
 end

---[[
--- *******************************************************************************************
--- NAME: FindGold()
--- DESC: This routines determines which gold total the ui wants (server or player) then calls it and returns it
--- *******************************************************************************************
---]]
+---local Get the gold total the user wants (server or player).
 local function FindGold()
 	if (not GOLD_INITIALIZED) then
 		-- in case there is no db entry for this toon, return blank.
@@ -1080,20 +1053,16 @@ local function FindGold()

 	ret_str = NiceCash(ttlgold, true, false)

-	return L["TITAN_GOLD_MENU_TEXT"]..": "..FONT_COLOR_CODE_CLOSE, ret_str
+	return L["TITAN_GOLD_MENU_TEXT"] .. ": " .. FONT_COLOR_CODE_CLOSE, ret_str
 end

---[[
--- **************************************************************************
--- NAME : OnLoad()
--- DESC : Registers the add on upon it loading
--- **************************************************************************
---]]
+---local Build the plugin .registry and init and register for events
+---@param self Button
 local function OnLoad(self)
 	local notes = ""
-		.."Keeps track of all gold held by a player's toons.\n"
-		.."- Can show by server / merged servers / all servers.\n"
-		.."- Can show by faction.\n"
+		.. "Keeps track of all gold held by a player's toons.\n"
+		.. "- Can show by server / merged servers / all servers.\n"
+		.. "- Can show by faction.\n"
 	self.registry = {
 		id = TITAN_GOLD_ID,
 		category = "Built-ins",
@@ -1141,19 +1110,15 @@ local function OnLoad(self)
 	self:RegisterEvent("PLAYER_ENTERING_WORLD");

 	if (not GoldSave) then
-		GoldSave={};
+		GoldSave = {};
 	end
-
+
 	-- Faction is English to use as index NOT display
-	GOLD_INDEX = UnitName("player").."_"..realmName.."::"..UnitFactionGroup("Player");
+	GOLD_INDEX = UnitName("player") .. "_" .. realmName .. "::" .. UnitFactionGroup("Player");
 end

---[[
--- **************************************************************************
--- NAME : OnShow()
--- DESC : Create repeating timer when plugin is visible
--- **************************************************************************
---]]
+---local When shown, register needed events and start timer for gold per hour
+---@param self Button
 local function OnShow(self)
 	self:RegisterEvent("PLAYER_MONEY");
 	if GoldSave and TitanGetVar(TITAN_GOLD_ID, "DisplayGoldPerHour") then
@@ -1168,26 +1133,20 @@ local function OnShow(self)
 	end
 end

---[[
--- **************************************************************************
--- NAME : OnHide()
--- DESC : Destroy repeating timer when plugin is hidden
--- **************************************************************************
---]]
+---local When shown, unregister needed events and stop timer for gold per hour
+---@param self Button
 local function OnHide(self)
 	self:UnregisterEvent("PLAYER_MONEY");
 	AceTimer:CancelTimer(GoldTimer)
 	GoldTimerRunning = false
 end

---[[
--- **************************************************************************
--- NAME : OnEvent()
--- DESC : This section will grab the events registered to the add on and act on them
--- **************************************************************************
---]]
+---local Handle registered events for this plugin
+---@param self Button
+---@param event string
+---@param ... any
 local function OnEvent(self, event, ...)
---[[
+	--[[
 print("_OnEvent"
 .." "..tostring(event)..""
 )
@@ -1209,22 +1168,23 @@ print("_OnEvent"
 	end
 end

+---local Create required Gold frames
 local function Create_Frames()
 	if _G[TITAN_BUTTON] then
 		return -- if already created
 	end
-
+
 	-- general container frame
 	local f = CreateFrame("Frame", nil, UIParent)
---	f:Hide()
+	--	f:Hide()

 	-- Titan plugin button
 	local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelComboTemplate")
 	window:SetFrameStrata("FULLSCREEN")
 	-- Using SetScript("OnLoad",   does not work
 	OnLoad(window);
---	TitanPanelButton_OnLoad(window); -- Titan XML template calls this...
-
+	--	TitanPanelButton_OnLoad(window); -- Titan XML template calls this...
+
 	window:SetScript("OnShow", function(self)
 		OnShow(self);
 		TitanPanelButton_OnShow(self);
@@ -1233,7 +1193,7 @@ local function Create_Frames()
 		OnHide(self);
 	end)
 	window:SetScript("OnEvent", function(self, event, ...)
-		OnEvent(self, event, ...)
+		OnEvent(self, event, ...)
 	end)
 end

diff --git a/TitanLocation/TitanLocation.lua b/TitanLocation/TitanLocation.lua
index 916ea16..6182503 100755
--- a/TitanLocation/TitanLocation.lua
+++ b/TitanLocation/TitanLocation.lua
@@ -13,14 +13,12 @@
 -- ******************************** Constants *******************************
 local _G = getfenv(0);
 local TITAN_LOCATION_ID = "Location";
-local TITAN_BUTTON = "TitanPanel"..TITAN_LOCATION_ID.."Button"
+local TITAN_BUTTON = "TitanPanel" .. TITAN_LOCATION_ID .. "Button"
 local TITAN_MAP_FRAME = "TitanMapFrame"
 local TITAN_LOCATION_VERSION = TITAN_VERSION;

 local addon_conflict = false -- used for addon conflicts
-local cachedX = 0;
-local cachedY = 0;
-local updateTable = {TITAN_LOCATION_ID, TITAN_PANEL_UPDATE_BUTTON};
+local updateTable = { TITAN_LOCATION_ID, TITAN_PANEL_UPDATE_BUTTON };
 -- ******************************** Variables *******************************
 local AceTimer = LibStub("AceTimer-3.0")
 local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)
@@ -29,34 +27,34 @@ local LocationTimerRunning = false

 local debug_flow = false

+local place = {
+	zoneText = "",
+	subZoneText = "",
+	pvpType = "",
+	factionName = "",
+	px = 0,
+	py = 0,
+	}
+
 ---@diagnostic disable-next-line: deprecated
 local GetZonePVP = C_PvP.GetZonePVPInfo or GetZonePVPInfo -- For Classic versions

 -- ******************************** Functions *******************************
---[[ local
--- **************************************************************************
--- NAME : debug_msg(Message)
--- DESC : Debug function to print message to chat frame
--- VARS : Message = message to print to chat frame
--- **************************************************************************
---]]
+
 local function debug_msg(Message)
 	local msg = ""
 	local stamp = date("%H:%M:%S") -- date("%m/%d/%y %H:%M:%S")
-	local milli = GetTime() -- seconds with millisecond precision (float)
+	local milli = GetTime()     -- seconds with millisecond precision (float)
 	local milli_str = string.format("%0.2F", milli - math.modf(milli))
-	msg = msg..TitanUtils_GetGoldText(stamp..milli_str.." "..TITAN_LOCATION_ID..": ")
-	msg = msg..TitanUtils_GetGreenText(Message)
+	msg = msg .. TitanUtils_GetGoldText(stamp .. milli_str .. " " .. TITAN_LOCATION_ID .. ": ")
+	msg = msg .. TitanUtils_GetGreenText(Message)
 	DEFAULT_CHAT_FRAME:AddMessage(msg)
---		DEFAULT_CHAT_FRAME:AddMessage(TITAN_LOCATION_ID..": " .. Message, 1.00, 0.49, 0.04)
+	--		DEFAULT_CHAT_FRAME:AddMessage(TITAN_LOCATION_ID..": " .. Message, 1.00, 0.49, 0.04)
 end

---[[ local
--- **************************************************************************
--- NAME : RegEvent()
--- DESC : Check if already registered, register if not
--- **************************************************************************
---]]
+---local Register event if not already registered
+---@param plugin Button
+---@param event string
 local function RegEvent(plugin, event)
 	if plugin:IsEventRegistered(event) then
 		-- already registered
@@ -65,15 +63,10 @@ local function RegEvent(plugin, event)
 	end
 end

---[[ local
--- **************************************************************************
--- NAME : Events()
--- DESC : Registers / unregisters events the plugin needs
--- **************************************************************************
---]]
+---local Registers / unregisters (action) events the plugin needs
+---@param action string
+---@param reason string
 local function Events(action, reason)
---[[
---]]
 	local plugin = _G[TITAN_BUTTON]

 	if action == "register" then
@@ -89,60 +82,58 @@ local function Events(action, reason)
 	end

 	if debug_flow then
-		local msg =
+		local msg =
 			"Events"
-			.." "..tostring(action)..""
-			.." "..tostring(reason)..""
+			.. " " .. tostring(action) .. ""
+			.. " " .. tostring(reason) .. ""
 		debug_msg(msg)
 	else
 		-- not requested
 	end
 end

---[[ local
--- **************************************************************************
--- NAME : GetPlayerMapPosition()
--- DESC : Get the player coordinates
--- VARS : x = location on x axis, y = location on y axis
--- **************************************************************************
---]]
+---local Get the player coordinates on x,y axis
+---@return number | nil X
+---@return number | nil Y
 local function GetPlayerMapPosition()
-    local mapID = C_Map.GetBestMapForUnit("player")
-    if mapID == nil then
-        return nil, nil
-    end
-
-    local position = C_Map.GetPlayerMapPosition(mapID, "player")
-    if position == nil then
-        return nil, nil
-    else
-    	return position:GetXY()
+	local mapID = C_Map.GetBestMapForUnit("player")
+	if mapID == nil then
+		return nil, nil
+	end
+
+	local position = C_Map.GetPlayerMapPosition(mapID, "player")
+	if position == nil then
+		return nil, nil
+	else
+		return position:GetXY()
 	end
 end

---[[
--- **************************************************************************
--- NAME : CheckForPositionUpdate()
--- DESC : Function to throttle down unnecessary updates
--- **************************************************************************
---]]
+---local Function to throttle down unnecessary updates
 local function CheckForPositionUpdate()
 	local mapID = C_Map.GetBestMapForUnit("player")
 	local tempx, tempy = GetPlayerMapPosition();
-	if tempx ~= cachedX or tempy ~= cachedY then
+	if tempx ~= place.px or tempy ~= place.py then
+		place.px = tempx
+		place.py = tempy
 		TitanPanelPluginHandle_OnUpdate(updateTable);
 	end
 end

+---local Update zone info of current toon
+---@param self Button
 local function ZoneUpdate(self)
 	local _ = nil
-	self.zoneText = GetZoneText();
-	self.subZoneText = GetSubZoneText();
-	self.pvpType, _, self.factionName = GetZonePVP();
+	place.zoneText = GetZoneText();
+	place.subZoneText = GetSubZoneText();
+	place.pvpType, _, place.factionName = GetZonePVP();

 	TitanPanelPluginHandle_OnUpdate(updateTable);
 end

+---local Set textg coord on map per user selection
+---@param player string
+---@param cursor string
 local function SetCoordText(player, cursor)
 	local player_frame = TitanMapPlayerLocation
 	local cursor_frame = TitanMapCursorLocation
@@ -193,12 +184,8 @@ local function SetCoordText(player, cursor)
 	end
 end

---[[
--- **************************************************************************
--- NAME : LocOnMiniMap()
--- DESC : Show / hide the location above the mini map per user settings
--- **************************************************************************
---]]
+---local Show / hide the location above the mini map per user settings
+---@param reason string
 local function LocOnMiniMap(reason)
 	if TitanGetVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap") then
 		MinimapBorderTop:Show()
@@ -208,21 +195,18 @@ local function LocOnMiniMap(reason)
 		MinimapZoneTextButton:Hide()
 		MiniMapWorldMapButton:Hide()
 	end
-
+
 	-- adjust MiniMap frame if needed
 	if reason == "config" then
 		TitanPanel_AdjustFrames(false, "Location");
 	else
-		-- 2024 Jan - Do not adjust; allow Titan to handle on PEW
+		-- 2024 Jan - Do not adjust; allow Titan to handle on PEW
 	end
 end

---[[
--- **************************************************************************
--- NAME : TitanMapFrame_OnUpdate()
--- DESC : Update coordinates on map
--- **************************************************************************
---]]
+---local Update coordinates on map
+---@param self Button
+---@param elapsed number
 local function TitanMapFrame_OnUpdate(self, elapsed)
 	-- Determine the text to show for player coords

@@ -248,13 +232,13 @@ local function TitanMapFrame_OnUpdate(self, elapsed)
 	end

 	if (TitanGetVar(TITAN_LOCATION_ID, "ShowCoordsOnMap")) then
-		self.px, self.py = GetPlayerMapPosition();
-		if self.px == nil then self.px = 0 end
-		if self.py == nil then self.py = 0 end
-		if self.px == 0 and self.py == 0 then
+		place.px, place.py = GetPlayerMapPosition();
+		if place.px == nil then place.px = 0 end
+		if place.py == nil then place.py = 0 end
+		if place.px == 0 and place.py == 0 then
 			playerLocationText = L["TITAN_LOCATION_NO_COORDS"]
 		else
-			playerLocationText = format(TitanGetVar(TITAN_LOCATION_ID, "CoordsFormat"), 100 * self.px, 100 * self.py);
+			playerLocationText = format(TitanGetVar(TITAN_LOCATION_ID, "CoordsFormat"), 100 * place.px, 100 * place.py);
 		end
 		playerLocationText = (format(player_format, TitanUtils_GetHighlightText(playerLocationText)));

@@ -263,7 +247,7 @@ local function TitanMapFrame_OnUpdate(self, elapsed)

 		-- use the global cursor position to confirm the cursor is over the map, but then use a normalized cursor position to account for map zooming
 		local left, bottom, width, height = WorldMapFrame.ScrollContainer:GetScaledRect();
-		if (cx > left and cy > bottom and cx < left + width and cy < bottom+ height) then
+		if (cx > left and cy > bottom and cx < left + width and cy < bottom + height) then
 			cx, cy = WorldMapFrame:GetNormalizedCursorPosition();
 			cx, cy = cx or 0, cy or 0;
 		else
@@ -280,12 +264,9 @@ local function TitanMapFrame_OnUpdate(self, elapsed)
 	SetCoordText(playerLocationText, cursorLocationText)
 end

---[[
--- Set the coordinates text for player and cursor
--- Used on update to refresh and on hide to clear the text
---]]
+---local Set the coordinates text for player and cursor. Used on update to refresh and on hide to clear the text.
+---@param action string Start | Stop
 local function CoordFrames(action)
-
 	local show_on_map = (TitanGetVar(TITAN_LOCATION_ID, "ShowCoordsOnMap") and true or false)
 	if addon_conflict then
 		-- do not attempt coords
@@ -294,7 +275,7 @@ local function CoordFrames(action)
 		if show_on_map then
 			if action == "start" then
 				local function updateFunc()
-					TitanMapFrame_OnUpdate(frame, 0.07);	-- simulating an OnUpdate call
+					TitanMapFrame_OnUpdate(frame, 0.07); -- simulating an OnUpdate call
 				end
 				frame:SetScript("OnShow", function()
 					frame.updateTicker = frame.updateTicker or C_Timer.NewTicker(0.07, updateFunc);
@@ -326,24 +307,18 @@ local function CoordFrames(action)
 	end

 	if debug_flow then
-		local msg =
+		local msg =
 			"CoordFrames"
-			.." "..tostring(action)..""
-			.." "..tostring(show_on_map)..""
-			.." "..tostring(addon_conflict)..""
+			.. " " .. tostring(action) .. ""
+			.. " " .. tostring(show_on_map) .. ""
+			.. " " .. tostring(addon_conflict) .. ""
 		debug_msg(msg)
 	else
 		-- not requested
 	end
 end

---[[
--- **************************************************************************
--- NAME : CreateMapFrames()
--- DESC : Adds player and cursor coords to the WorldMapFrame, unless the player has CT_MapMod
--- VARS : none
--- **************************************************************************
---]]
+---local Adds player and cursor coords to the WorldMapFrame, unless the player has CT_MapMod
 local function CreateMapFrames()
 	if _G[TITAN_MAP_FRAME] then
 		return -- if already created
@@ -356,9 +331,9 @@ local function CreateMapFrames()
 	end

 	if debug_flow then
-		local msg =
-			"CreateMapFrames"
---			.." "..tostring(reason)..""
+		local msg =
+		"CreateMapFrames"
+		--			.." "..tostring(reason)..""
 		debug_msg(msg)
 	else
 		-- not requested
@@ -377,18 +352,13 @@ local function CreateMapFrames()
 	cursortext:SetPoint("TOP", playertext, "BOTTOM", 0, 0)
 end

---[[
--- **************************************************************************
--- NAME : OnShow()
--- DESC : Display button when plugin is visible
--- **************************************************************************
---]]
+---local Display button when plugin is visible
+---@param self Button
 local function OnShow(self)
-
 	if debug_flow then
-		local msg =
-			"_OnShow"
---			.." "..tostring(reason)..""
+		local msg =
+		"_OnShow"
+		--			.." "..tostring(reason)..""
 		debug_msg(msg)
 	else
 		-- not requested
@@ -404,153 +374,157 @@ local function OnShow(self)
 	CoordFrames("start") -- start coords on map, if requested

 	Events("register", "_OnShow")
-
+
 	-- Zone may not be available yet, PEW event should correct
 	ZoneUpdate(self);

 	TitanPanelButton_UpdateButton(TITAN_LOCATION_ID);
 end

---[[
--- **************************************************************************
--- NAME : OnHide()
--- DESC : Destroy repeating timer when plugin is hidden
--- **************************************************************************
---]]
+---local Destroy repeating timer when plugin is hidden
+---@param self Button
 local function OnHide(self)
 	AceTimer:CancelTimer(LocationTimer)
 	LocationTimerRunning = false
-
+
 	Events("unregister", "_OnHide")
 	CoordFrames("stop") -- stop coords on map, if requested
 end

---[[
--- **************************************************************************
--- NAME : GetButtonText(id)
--- DESC : Calculate coordinates and then display data on button
--- VARS : id = button ID
--- **************************************************************************
---]]
+---local Calculate coordinates and then display data on button.
+---@param id string
+---@return string plugin_label
+---@return string plugin_text
 local function GetButtonText(id)
-	local button, id = TitanUtils_GetButton(id);
-	local locationText = ""
-
-	-- Coordinates text, if requested
-	if button and TitanGetVar(TITAN_LOCATION_ID, "ShowCoordsText") then
-		button.px, button.py = GetPlayerMapPosition();
-		cachedX = button.px;
-		cachedY = button.py;
-		if button.px == nil then button.px = 0 end
-		if button.py == nil then button.py = 0 end
-
-		if button.px == 0 and button.py == 0 then
-			locationText = "";
+	-- Jul 2024 : Made display only; vars assigned per timer or events.
+	local button = TitanUtils_GetButton(id);
+	local locationRichText = ""
+
+	local zone_text = ""
+	local subzone_text = ""
+	local xy_text = ""
+
+	if button then -- sanity check
+		-- Set in order of display on plugin...
+
+		-- Zone text, if requested
+		if TitanGetVar(TITAN_LOCATION_ID, "ShowZoneText") then
+			zone_text = TitanUtils_ToString(place.zoneText)
 		else
-		locationText = format(TitanGetVar(TITAN_LOCATION_ID, "CoordsFormat"), 100 * button.px, 100 * button.py)
+			zone_text = ""
+		end
+
+		-- subZone text, if requested
+		if TitanGetVar(TITAN_LOCATION_ID, "ShowSubZoneText") then
+			subzone_text = TitanUtils_ToString(place.subZoneText)
+		else
+			subzone_text = ""
+		end
+
+		-- seperator, if needed
+		if (zone_text:len() > 0) and (subzone_text:len() > 0) then
+			zone_text = zone_text .. " "
+		else
+			-- no seperator needed
 		end
-	else
-		locationText = "";
-	end

-	-- Zone text, if requested
-	if button and TitanGetVar(TITAN_LOCATION_ID, "ShowZoneText") then
-		if (TitanUtils_ToString(button.subZoneText) == '') then
-			if (button.zoneText == '') then
-				local Map_unit = C_Map.GetBestMapForUnit -- DF change of API
-								or C_Map.GetBestMapUnit
-				local _
-				_, _, button.zoneText = C_Map.GetMapInfo(Map_unit("player"));
+		-- Coordinates text, if requested
+		if TitanGetVar(TITAN_LOCATION_ID, "ShowCoordsText") then
+			if place.px == 0 and place.py == 0 then
+				xy_text = L["TITAN_LOCATION_NO_COORDS"]
+			else
+				xy_text = format(TitanGetVar(TITAN_LOCATION_ID, "CoordsFormat"), 100 * place.px, 100 * place.py)
 			end
-			locationText = TitanUtils_ToString(button.zoneText)..' '..locationText;
 		else
-			locationText = TitanUtils_ToString(button.subZoneText)..' '..locationText;
+			xy_text = "";
 		end
-	else
-		if button and button.px == 0 and button.py == 0 then
-			locationText = L["TITAN_LOCATION_NO_COORDS"];
+
+		-- seperator, if needed
+		if ((zone_text:len() > 0) or (subzone_text:len() > 0))
+		and (xy_text:len() > 0) then
+			subzone_text = subzone_text .. " "
+		else
+			-- no seperator needed
 		end
+	else
+		locationRichText = "? id"
 	end
-
 	-- Color per type of zone (friendly, contested, hostile)
-	local locationRichText;
+	locationRichText = zone_text..subzone_text..xy_text
 	if (TitanGetVar(TITAN_LOCATION_ID, "ShowColoredText")) then
-		if (TitanPanelLocationButton.isArena) then
-			locationRichText = TitanUtils_GetRedText(locationText);
-		elseif (TitanPanelLocationButton.pvpType == "friendly") then
-			locationRichText = TitanUtils_GetGreenText(locationText);
-		elseif (TitanPanelLocationButton.pvpType == "hostile") then
-			locationRichText = TitanUtils_GetRedText(locationText);
-		elseif (TitanPanelLocationButton.pvpType == "contested") then
-			locationRichText = TitanUtils_GetNormalText(locationText);
+		if (place.isArena) then
+			locationRichText = TitanUtils_GetRedText(locationRichText);
+		elseif (place.pvpType == "friendly") then
+			locationRichText = TitanUtils_GetGreenText(locationRichText);
+		elseif (place.pvpType == "hostile") then
+			locationRichText = TitanUtils_GetRedText(locationRichText);
+		elseif (place.pvpType == "contested") then
+			locationRichText = TitanUtils_GetNormalText(locationRichText);
 		else
-			locationRichText = TitanUtils_GetNormalText(locationText);
+			locationRichText = TitanUtils_GetNormalText(locationRichText);
 		end
 	else
-		locationRichText = TitanUtils_GetHighlightText(locationText);
+		locationRichText = TitanUtils_GetHighlightText(locationRichText);
 	end

 	return L["TITAN_LOCATION_BUTTON_LABEL"], locationRichText;
 end

---[[
--- **************************************************************************
--- NAME : GetTooltipText()
--- DESC : Display tooltip text
--- **************************************************************************
---]]
+---local Get tooltip text
+---@return string formatted_tooltip
 local function GetTooltipText()
 	local pvpInfoRichText;

 	pvpInfoRichText = "";
-	if (TitanPanelLocationButton.pvpType == "sanctuary") then
+	if (place.pvpType == "sanctuary") then
 		pvpInfoRichText = TitanUtils_GetGreenText(SANCTUARY_TERRITORY);
-	elseif (TitanPanelLocationButton.pvpType == "arena") then
-		TitanPanelLocationButton.subZoneText = TitanUtils_GetRedText(TitanPanelLocationButton.subZoneText);
+	elseif (place.pvpType == "arena") then
+		place.subZoneText = TitanUtils_GetRedText(place.subZoneText);
 		pvpInfoRichText = TitanUtils_GetRedText(CONTESTED_TERRITORY);
-		elseif (TitanPanelLocationButton.pvpType == "friendly") then
-		pvpInfoRichText = TitanUtils_GetGreenText(format(FACTION_CONTROLLED_TERRITORY, TitanPanelLocationButton.factionName));
-	elseif (TitanPanelLocationButton.pvpType == "hostile") then
-		pvpInfoRichText = TitanUtils_GetRedText(format(FACTION_CONTROLLED_TERRITORY, TitanPanelLocationButton.factionName));
-	elseif (TitanPanelLocationButton.pvpType == "contested") then
+	elseif (place.pvpType == "friendly") then
+		pvpInfoRichText = TitanUtils_GetGreenText(format(FACTION_CONTROLLED_TERRITORY,
+			place.factionName));
+	elseif (place.pvpType == "hostile") then
+		pvpInfoRichText = TitanUtils_GetRedText(format(FACTION_CONTROLLED_TERRITORY, place
+		.factionName));
+	elseif (place.pvpType == "contested") then
 		pvpInfoRichText = TitanUtils_GetRedText(CONTESTED_TERRITORY);
 	else
 		pvpInfoRichText = ""
 	end

 	-- build the tool tip
-	local zone = TitanUtils_GetHighlightText(TitanPanelLocationButton.zoneText) or ""
+	local zone = TitanUtils_GetHighlightText(place.zoneText) or ""
 	local sub_zone = TitanUtils_Ternary(
-			(TitanPanelLocationButton.subZoneText == ""),
-			"",
-			L["TITAN_LOCATION_TOOLTIP_SUBZONE"].."\t"..TitanUtils_GetHighlightText(TitanPanelLocationButton.subZoneText).."\n"
-			)
+		(place.subZoneText == ""),
+		"",
+		L["TITAN_LOCATION_TOOLTIP_SUBZONE"] ..
+		"\t" .. TitanUtils_GetHighlightText(place.subZoneText) .. "\n"
+	)
 	local bind_loc = TitanUtils_GetHighlightText(GetBindLocation())

-	return ""..
-		L["TITAN_LOCATION_TOOLTIP_ZONE"].."\t"..zone.."\n"
-		..sub_zone.."\n"
-		..TitanUtils_GetHighlightText(L["TITAN_LOCATION_TOOLTIP_HOMELOCATION"]).."\n"
-		..L["TITAN_LOCATION_TOOLTIP_INN"].."\t"..bind_loc.."\n"
-		..pvpInfoRichText.."\n\n"
-		..TitanUtils_GetGreenText(L["TITAN_LOCATION_TOOLTIP_HINTS_1"]).."\n"
-		..TitanUtils_GetGreenText(L["TITAN_LOCATION_TOOLTIP_HINTS_2"])
+	return "" ..
+		L["TITAN_LOCATION_TOOLTIP_ZONE"] .. "\t" .. zone .. "\n"
+		.. sub_zone .. "\n"
+		.. TitanUtils_GetHighlightText(L["TITAN_LOCATION_TOOLTIP_HOMELOCATION"]) .. "\n"
+		.. L["TITAN_LOCATION_TOOLTIP_INN"] .. "\t" .. bind_loc .. "\n"
+		.. pvpInfoRichText .. "\n\n"
+		.. TitanUtils_GetGreenText(L["TITAN_LOCATION_TOOLTIP_HINTS_1"]) .. "\n"
+		.. TitanUtils_GetGreenText(L["TITAN_LOCATION_TOOLTIP_HINTS_2"])
 end

---[[
--- **************************************************************************
--- NAME : OnEvent()
--- DESC : Parse events registered to plugin and act on them
--- **************************************************************************
---]]
+---local Handle events registered to plugin
+---@param self Button
+---@param event string
+---@param ... any
 local function OnEvent(self, event, ...)
--- DF TODO See if we can turn off zone on minimap
---[=[
+	-- DF TODO See if we can turn off zone on minimap
+	--[=[
 --]=]
 	if debug_flow then
-		local msg =
+		local msg =
 			"_OnEvent"
-			.." "..tostring(event)..""
+			.. " " .. tostring(event) .. ""
 		debug_msg(msg)
 	else
 		-- not requested
@@ -558,7 +532,7 @@ local function OnEvent(self, event, ...)

 	if TITAN_ID == "TitanClassic" then
 		if event == "PLAYER_ENTERING_WORLD" then
-			if not TitanGetVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap")
+			if not TitanGetVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap")
 				and MinimapBorderTop and MinimapBorderTop:IsShown() then
 				LocOnMiniMap("PEW")
 			end
@@ -572,24 +546,20 @@ local function OnEvent(self, event, ...)
 	end

 	ZoneUpdate(self);
---[[
+	--[[
 --]]
 end

---[[
--- **************************************************************************
--- NAME : OnClick(button)
--- DESC : Copies coordinates to chat line for shift-LeftClick
--- VARS : button = value of action
--- **************************************************************************
---]]
+---local Handle events registered to plugin. Copies coordinates to chat line for shift-LeftClick
+---@param self Button
+---@param button string
 local function OnClick(self, button)
 	if (button == "LeftButton") then
 		if (IsShiftKeyDown()) then
 			local activeWindow = ChatEdit_GetActiveWindow();
-			if ( activeWindow ) then
-				local message = TitanUtils_ToString(self.zoneText).." "..
-					format(TitanGetVar(TITAN_LOCATION_ID, "CoordsFormat"), 100 * self.px, 100 * self.py);
+			if (activeWindow) then
+				local message = TitanUtils_ToString(place.zoneText) .. " " ..
+					format(TitanGetVar(TITAN_LOCATION_ID, "CoordsFormat"), 100 * place.px, 100 * place.py);
 				activeWindow:Insert(message);
 			end
 		else
@@ -598,6 +568,7 @@ local function OnClick(self, button)
 	end
 end

+---local Create right click menu
 local function CreateMenu()
 	local info

@@ -628,7 +599,7 @@ local function CreateMenu()
 		TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());

 		TitanPanelRightClickMenu_AddControlVars(TITAN_LOCATION_ID)
-	-- level 2
+		-- level 2
 	elseif TitanPanelRightClickMenu_GetDropdownLevel() == 2 then
 		if TitanPanelRightClickMenu_GetDropdMenuValue() == "Options" then
 			TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_OPTIONS"], TitanPanelRightClickMenu_GetDropdownLevel());
@@ -677,15 +648,15 @@ local function CreateMenu()
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());

 			if TITAN_ID == "TitanClassic" then
-			info = {};
-			info.text = L["TITAN_LOCATION_MENU_SHOW_LOC_ON_MINIMAP_TEXT"];
-			info.func = function()
-				TitanToggleVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap");
-				LocOnMiniMap("config")
-			end
-			info.checked = TitanGetVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap");
-			info.disabled = InCombatLockdown()
-			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+				info = {};
+				info.text = L["TITAN_LOCATION_MENU_SHOW_LOC_ON_MINIMAP_TEXT"];
+				info.func = function()
+					TitanToggleVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap");
+					LocOnMiniMap("config")
+				end
+				info.checked = TitanGetVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap");
+				info.disabled = InCombatLockdown()
+				TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 			else
 				-- no work needed
 			end
@@ -697,11 +668,11 @@ local function CreateMenu()
 			info.checked = TitanGetVar(TITAN_LOCATION_ID, "UpdateWorldmap");
 			info.disabled = InCombatLockdown()
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-
 		end

 		if TitanPanelRightClickMenu_GetDropdMenuValue() == "CoordFormat" then
-			TitanPanelRightClickMenu_AddTitle(L["TITAN_LOCATION_FORMAT_COORD_LABEL"], TitanPanelRightClickMenu_GetDropdownLevel());
+			TitanPanelRightClickMenu_AddTitle(L["TITAN_LOCATION_FORMAT_COORD_LABEL"],
+				TitanPanelRightClickMenu_GetDropdownLevel());
 			info = {};
 			info.text = L["TITAN_LOCATION_FORMAT_LABEL"];
 			info.func = function()
@@ -766,15 +737,14 @@ local function CreateMenu()
 			end
 		end

-	-- level 3
+		-- level 3
 	elseif TitanPanelRightClickMenu_GetDropdownLevel() == 3 then
 		if TitanPanelRightClickMenu_GetDropdMenuValue() == "CoordsLoc" then
-
 			info = {};
 			info.text = L["TITAN_PANEL_MENU_BOTTOM"];
 			info.func = function()
 				TitanSetVar(TITAN_LOCATION_ID, "CoordsLoc", "Bottom");
---				TitanPanelButton_UpdateButton(TITAN_LOCATION_ID);
+				--				TitanPanelButton_UpdateButton(TITAN_LOCATION_ID);
 			end
 			info.checked = (TitanGetVar(TITAN_LOCATION_ID, "CoordsLoc") == "Bottom")
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
@@ -783,7 +753,7 @@ local function CreateMenu()
 			info.text = L["TITAN_PANEL_MENU_TOP"];
 			info.func = function()
 				TitanSetVar(TITAN_LOCATION_ID, "CoordsLoc", "Top");
---				TitanPanelButton_UpdateButton(TITAN_LOCATION_ID);
+				--				TitanPanelButton_UpdateButton(TITAN_LOCATION_ID);
 			end
 			info.checked = (TitanGetVar(TITAN_LOCATION_ID, "CoordsLoc") == "Top")
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
@@ -791,16 +761,12 @@ local function CreateMenu()
 	end
 end

---[[
--- **************************************************************************
--- NAME : OnLoad()
--- DESC : Registers the plugin upon it loading
--- **************************************************************************
---]]
+---local Create the plugin .registry and register startign events
+---@param self Button
 local function OnLoad(self)
 	local notes = ""
-		.."Adds coordinates and location information to Titan Panel.\n"
---		.."- xxx.\n"
+		.. "Adds coordinates and location information to Titan Panel.\n"
+	--		.."- xxx.\n"
 	self.registry = {
 		id = TITAN_LOCATION_ID,
 		category = "Built-ins",
@@ -822,7 +788,7 @@ local function OnLoad(self)
 		},
 		savedVariables = {
 			ShowZoneText = 1,
-            ShowSubZoneText = true,
+			ShowSubZoneText = true,
 			ShowCoordsText = true,
 			ShowCoordsOnMap = true,
 			ShowCursorOnMap = true,
@@ -839,35 +805,34 @@ local function OnLoad(self)
 	};

 	RegEvent(self, "PLAYER_ENTERING_WORLD")
-
+
 	if debug_flow then
-		local msg =
-			"_OnLoad"
---			.." "..tostring(reason)..""
+		local msg =
+		"_OnLoad"
+		--			.." "..tostring(reason)..""
 		debug_msg(msg)
 	else
 		-- not requested
 	end
-
 end

--- ====== Create needed frames
+---local Create needed frames
 local function Create_Frames()
 	if _G[TITAN_BUTTON] then
 		return -- if already created
 	end
-
+
 	-- general container frame
 	local f = CreateFrame("Frame", nil, UIParent)
---	f:Hide()
+	--	f:Hide()

 	-- Titan plugin button
 	local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelComboTemplate")
 	window:SetFrameStrata("FULLSCREEN")
 	-- Using SetScript("OnLoad",   does not work
 	OnLoad(window);
---	TitanPanelButton_OnLoad(window); -- Titan XML template calls this...
-
+	--	TitanPanelButton_OnLoad(window); -- Titan XML template calls this...
+
 	window:SetScript("OnShow", function(self)
 		OnShow(self);
 		TitanPanelButton_OnShow(self);
@@ -876,7 +841,7 @@ local function Create_Frames()
 		OnHide(self)
 	end)
 	window:SetScript("OnEvent", function(self, event, ...)
-		OnEvent(self, event, ...)
+		OnEvent(self, event, ...)
 	end)
 	window:SetScript("OnClick", function(self, button)
 		OnClick(self, button);
diff --git a/TitanPerformance/TitanPerformance.lua b/TitanPerformance/TitanPerformance.lua
index 4fa3e8f..651ee5d 100644
--- a/TitanPerformance/TitanPerformance.lua
+++ b/TitanPerformance/TitanPerformance.lua
@@ -7,10 +7,10 @@

 -- ******************************** Constants *******************************
 local TITAN_PERFORMANCE_ID = "Performance";
-local TITAN_BUTTON = "TitanPanel"..TITAN_PERFORMANCE_ID.."Button"
+local TITAN_BUTTON = "TitanPanel" .. TITAN_PERFORMANCE_ID .. "Button"

 local TITAN_PERF_FRAME_SHOW_TIME = 0.5;
-local updateTable = {TITAN_PERFORMANCE_ID, TITAN_PANEL_UPDATE_ALL};
+local updateTable = { TITAN_PERFORMANCE_ID, TITAN_PANEL_UPDATE_ALL };

 local APP_MIN = 1
 local APP_MAX = 40
@@ -29,7 +29,7 @@ local TITAN_FPS_THRESHOLD_TABLE = {

 -- #1369 - PERFORMANCEBAR_LOW_LATENCY, PERFORMANCEBAR_MEDIUM_LATENCY no longer defined by WoW
 local TITAN_LATENCY_THRESHOLD_TABLE = {
-	Values = { 300, 600 },
+	Values = { 300, 600 },
 	Colors = { GREEN_FONT_COLOR, NORMAL_FONT_COLOR, RED_FONT_COLOR },
 }

@@ -47,7 +47,13 @@ local AceTimer = LibStub("AceTimer-3.0")
 local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)
 local PerfTimer = {}
 local PerfTimerRunning = false
+
+local perf_stats = {}
 -- ******************************** Functions *******************************
+
+---local Use user selected with required min of 1
+---@param val number
+---@return number
 local function CalcAppNum(val)
 	local new_val = 1 -- always monitor at least one

@@ -60,14 +66,11 @@ local function CalcAppNum(val)
 	return new_val
 end

---[[
--- **************************************************************************
--- NAME : Stats_UpdateAddonsList(self, watchingCPU)
--- DESC : Execute garbage collection for Leftclick on button
--- **************************************************************************
---]]
+---local Execute garbage collection for Leftclick on plugin
+---@param self Button
+---@param watchingCPU boolean
 local function Stats_UpdateAddonsList(self, watchingCPU)
-	if(watchingCPU) then
+	if (watchingCPU) then
 		UpdateAddOnCPUUsage()
 	else
 		UpdateAddOnMemoryUsage()
@@ -75,20 +78,20 @@ local function Stats_UpdateAddonsList(self, watchingCPU)

 	local total = 0
 	local showAddonRate = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowAddonIncRate");
-	for i=1, NumAddons() do
+	for i = 1, NumAddons() do
 		local value = (watchingCPU and GetAddOnCPUUsage(i)) or GetAddOnMemoryUsage(i)
 		total = total + value

-		for j,addon in ipairs(topAddOns) do
-			if(value > addon.value) then
+		for j, addon in ipairs(topAddOns) do
+			if (value > addon.value) then
 				for k = counter, 1, -1 do
-					if(k == j) then
+					if (k == j) then
 						topAddOns[k].value = value
 						topAddOns[k].name = AddOnInfo(i)
 						break
-					elseif(k ~= 1) then
-						topAddOns[k].value = topAddOns[k-1].value
-						topAddOns[k].name = topAddOns[k-1].name
+					elseif (k ~= 1) then
+						topAddOns[k].value = topAddOns[k - 1].value
+						topAddOns[k].name = topAddOns[k - 1].name
 					end
 				end
 				break
@@ -99,158 +102,194 @@ local function Stats_UpdateAddonsList(self, watchingCPU)
 	GameTooltip:AddLine(' ')

 	if (total > 0) then
-		if(watchingCPU) then
-			GameTooltip:AddLine('|cffffffff'..L["TITAN_PERFORMANCE_ADDON_CPU_USAGE_LABEL"])
+		if (watchingCPU) then
+			GameTooltip:AddLine(TitanUtils_GetHexText(L["TITAN_PERFORMANCE_ADDON_CPU_USAGE_LABEL"], Titan_Global.colors.white))
 		else
-			GameTooltip:AddLine('|cffffffff'..L["TITAN_PERFORMANCE_ADDON_MEM_USAGE_LABEL"])
+			GameTooltip:AddLine(TitanUtils_GetHexText(L["TITAN_PERFORMANCE_ADDON_MEM_USAGE_LABEL"], Titan_Global.colors.white))
 		end

 		if not watchingCPU then
 			if (showAddonRate == 1) then
-				GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE..L["TITAN_PERFORMANCE_ADDON_NAME_LABEL"],LIGHTYELLOW_FONT_COLOR_CODE..L["TITAN_PERFORMANCE_ADDON_USAGE_LABEL"].."/"..L["TITAN_PERFORMANCE_ADDON_RATE_LABEL"]..":")
+				GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE .. L["TITAN_PERFORMANCE_ADDON_NAME_LABEL"],
+					LIGHTYELLOW_FONT_COLOR_CODE ..
+					L["TITAN_PERFORMANCE_ADDON_USAGE_LABEL"] .. "/" .. L["TITAN_PERFORMANCE_ADDON_RATE_LABEL"] .. ":")
 			else
-				GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE..L["TITAN_PERFORMANCE_ADDON_NAME_LABEL"],LIGHTYELLOW_FONT_COLOR_CODE..L["TITAN_PERFORMANCE_ADDON_USAGE_LABEL"]..":")
+				GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE .. L["TITAN_PERFORMANCE_ADDON_NAME_LABEL"],
+					LIGHTYELLOW_FONT_COLOR_CODE .. L["TITAN_PERFORMANCE_ADDON_USAGE_LABEL"] .. ":")
 			end
 		end

 		if watchingCPU then
-			GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE..L["TITAN_PERFORMANCE_ADDON_NAME_LABEL"],LIGHTYELLOW_FONT_COLOR_CODE..L["TITAN_PERFORMANCE_ADDON_USAGE_LABEL"]..":")
+			GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE .. L["TITAN_PERFORMANCE_ADDON_NAME_LABEL"],
+				LIGHTYELLOW_FONT_COLOR_CODE .. L["TITAN_PERFORMANCE_ADDON_USAGE_LABEL"] .. ":")
 		end

-		for _,addon in ipairs(topAddOns) do
-			if(watchingCPU) then
-				local diff = addon.value/total * 100;
+		for _, addon in ipairs(topAddOns) do
+			local wow_addon = TitanUtils_GetHexText(addon.name, Titan_Global.colors.yellow)
+			if (watchingCPU) then
+				local diff = addon.value / total * 100;
 				local incrate = "";
 				incrate = format("(%.2f%%)", diff);
 				if (showAddonRate == 1) then
-					GameTooltip:AddDoubleLine(NORMAL_FONT_COLOR_CODE..addon.name," |cffffffff"..format("%.3f",addon.value)..L["TITAN_PANEL_MILLISECOND"].." "..GREEN_FONT_COLOR_CODE..incrate);
+					local str = TitanUtils_GetHexText(format("%.3f", addon.value)
+							.. L["TITAN_PANEL_MILLISECOND"], Titan_Global.colors.white)
+						.." "
+						..TitanUtils_GetHexText(incrate, Titan_Global.colors.green)
+					GameTooltip:AddDoubleLine(wow_addon, str)
 				else
-					GameTooltip:AddDoubleLine(NORMAL_FONT_COLOR_CODE..addon.name," |cffffffff"..format("%.3f",addon.value)..L["TITAN_PANEL_MILLISECOND"]);
+					local str = TitanUtils_GetHexText(format("%.3f", addon.value)
+						.. L["TITAN_PANEL_MILLISECOND"], Titan_Global.colors.white)
+					GameTooltip:AddDoubleLine(wow_addon, str);
 				end
 			else
 				local diff = addon.value - (memUsageSinceGC[addon.name])
-				if diff < 0 or memUsageSinceGC[addon.name]== 0 then
+				if diff < 0 or memUsageSinceGC[addon.name] == 0 then
 					memUsageSinceGC[addon.name] = addon.value;
 				end
 				local incrate = "";
 				if diff > 0 then
-					incrate = format("(+%.2f) "..L["TITAN_PANEL_PERFORMANCE_KILOBYTES_PER_SECOND"], diff);
+					incrate = format("(+%.2f) " .. L["TITAN_PANEL_PERFORMANCE_KILOBYTES_PER_SECOND"], diff);
 				end
+				local fmt = ""
+				local div = 1
+				local rate = ""
 				if (showAddonRate == 1) then
 					if TitanGetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType") == 1 then
-					GameTooltip:AddDoubleLine(NORMAL_FONT_COLOR_CODE..addon.name," |cffffffff"..format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], addon.value/1000).." "..GREEN_FONT_COLOR_CODE..incrate)
+						fmt = L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"]
+						div = 1000
+						rate = TitanUtils_GetHexText(incrate, Titan_Global.colors.green)
 					else
 						if addon.value > 1000 then
-							GameTooltip:AddDoubleLine(NORMAL_FONT_COLOR_CODE..addon.name," |cffffffff"..format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], addon.value/1000).." "..GREEN_FONT_COLOR_CODE..incrate)
+							fmt = L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"]
+							div = 1000
+							rate = TitanUtils_GetHexText(incrate, Titan_Global.colors.green)
 						else
-							GameTooltip:AddDoubleLine(NORMAL_FONT_COLOR_CODE..addon.name," |cffffffff"..format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT_KB"], addon.value).." "..GREEN_FONT_COLOR_CODE..incrate)
+							fmt = L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT_KB"]
+							rate = TitanUtils_GetHexText(incrate, Titan_Global.colors.green)
 						end
 					end
 				else
 					if TitanGetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType") == 1 then
-					GameTooltip:AddDoubleLine(NORMAL_FONT_COLOR_CODE..addon.name," |cffffffff"..format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], addon.value/1000))
+						fmt = L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"]
+						div = 1000
 					else
 						if addon.value > 1000 then
-							GameTooltip:AddDoubleLine(NORMAL_FONT_COLOR_CODE..addon.name," |cffffffff"..format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], addon.value/1000))
+							fmt = L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"]
+							div = 1000
 						else
-							GameTooltip:AddDoubleLine(NORMAL_FONT_COLOR_CODE..addon.name," |cffffffff"..format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT_KB"], addon.value))
+							fmt = L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT_KB"]
 						end
 					end
 				end
+				GameTooltip:AddDoubleLine(wow_addon,
+				TitanUtils_GetHexText(format(fmt, addon.value / div), Titan_Global.colors.white)..rate)
 			end
 		end

 		GameTooltip:AddLine(' ')

-		if(watchingCPU) then
-			GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE..L["TITAN_PERFORMANCE_ADDON_TOTAL_CPU_USAGE_LABEL"], format("%.3f",total)..L["TITAN_PANEL_MILLISECOND"])
+		if (watchingCPU) then
+			GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE .. L["TITAN_PERFORMANCE_ADDON_TOTAL_CPU_USAGE_LABEL"],
+				format("%.3f", total) .. L["TITAN_PANEL_MILLISECOND"])
 		else
 			if TitanGetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType") == 1 then
-			GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE..L["TITAN_PERFORMANCE_ADDON_TOTAL_MEM_USAGE_LABEL"],format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], total/1000))
+				GameTooltip:AddDoubleLine(
+				LIGHTYELLOW_FONT_COLOR_CODE .. L["TITAN_PERFORMANCE_ADDON_TOTAL_MEM_USAGE_LABEL"],
+					format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], total / 1000))
 			else
 				if total > 1000 then
-					GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE..L["TITAN_PERFORMANCE_ADDON_TOTAL_MEM_USAGE_LABEL"], format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], total/1000))
+					GameTooltip:AddDoubleLine(
+					LIGHTYELLOW_FONT_COLOR_CODE .. L["TITAN_PERFORMANCE_ADDON_TOTAL_MEM_USAGE_LABEL"],
+						format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], total / 1000))
 				else
-					GameTooltip:AddDoubleLine(LIGHTYELLOW_FONT_COLOR_CODE..L["TITAN_PERFORMANCE_ADDON_TOTAL_MEM_USAGE_LABEL"], format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT_KB"], total))
+					GameTooltip:AddDoubleLine(
+					LIGHTYELLOW_FONT_COLOR_CODE .. L["TITAN_PERFORMANCE_ADDON_TOTAL_MEM_USAGE_LABEL"],
+						format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT_KB"], total))
 				end
 			end
 		end
 	end
 end

---[[
--- **************************************************************************
--- NAME : SetTooltip()
--- DESC : Display tooltip text
--- **************************************************************************
---]]
-local function SetTooltip()
+---local Generate tootip text
+---@param self Button
+local function SetTooltip(self)
 	local button = _G["TitanPanelPerformanceButton"];
 	local showFPS = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowFPS");
 	local showLatency = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowLatency");
 	local showWorldLatency = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowWorldLatency")
 	local showMemory = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowMemory");
 	local showAddonMemory = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowAddonMemory");
-
 	-- Tooltip title
-	GameTooltip:SetText(L["TITAN_PERFORMANCE_TOOLTIP"], HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
+	GameTooltip:SetText(L["TITAN_PERFORMANCE_TOOLTIP"], HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g,
+		HIGHLIGHT_FONT_COLOR.b);

 	-- FPS tooltip
-	if ( showFPS ) then
-		local fpsText = format(L["TITAN_PANEL_PERFORMANCE_FPS_FORMAT"], button.fps);
-		local avgFPSText = format(L["TITAN_PANEL_PERFORMANCE_FPS_FORMAT"], button.avgFPS);
-		local minFPSText = format(L["TITAN_PANEL_PERFORMANCE_FPS_FORMAT"], button.minFPS);
-		local maxFPSText = format(L["TITAN_PANEL_PERFORMANCE_FPS_FORMAT"], button.maxFPS);
+	if (showFPS) then
+		local fpsText = format(L["TITAN_PANEL_PERFORMANCE_FPS_FORMAT"], perf_stats.fps);
+		local avgFPSText = format(L["TITAN_PANEL_PERFORMANCE_FPS_FORMAT"], perf_stats.avgFPS);
+		local minFPSText = format(L["TITAN_PANEL_PERFORMANCE_FPS_FORMAT"], perf_stats.minFPS);
+		local maxFPSText = format(L["TITAN_PANEL_PERFORMANCE_FPS_FORMAT"], perf_stats.maxFPS);

 		GameTooltip:AddLine("\n");
 		GameTooltip:AddLine(TitanUtils_GetHighlightText(L["TITAN_PANEL_PERFORMANCE_FPS_TOOLTIP"]));
-		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_FPS_TOOLTIP_CURRENT_FPS"], TitanUtils_GetHighlightText(fpsText));
-		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_FPS_TOOLTIP_AVG_FPS"], TitanUtils_GetHighlightText(avgFPSText));
-		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_FPS_TOOLTIP_MIN_FPS"], TitanUtils_GetHighlightText(minFPSText));
-		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_FPS_TOOLTIP_MAX_FPS"], TitanUtils_GetHighlightText(maxFPSText));
+		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_FPS_TOOLTIP_CURRENT_FPS"],
+			TitanUtils_GetHighlightText(fpsText));
+		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_FPS_TOOLTIP_AVG_FPS"],
+			TitanUtils_GetHighlightText(avgFPSText));
+		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_FPS_TOOLTIP_MIN_FPS"],
+			TitanUtils_GetHighlightText(minFPSText));
+		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_FPS_TOOLTIP_MAX_FPS"],
+			TitanUtils_GetHighlightText(maxFPSText));
 	end

 	-- Latency tooltip
-	if ( showLatency or showWorldLatency ) then
-		local latencyText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_FORMAT"], button.latencyHome);
-		local latencyWorldText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_FORMAT"], button.latencyWorld);
-		local bandwidthInText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_BANDWIDTH_FORMAT"], button.bandwidthIn);
-		local bandwidthOutText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_BANDWIDTH_FORMAT"], button.bandwidthOut);
+	if (showLatency or showWorldLatency) then
+		local latencyText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_FORMAT"], perf_stats.latencyHome);
+		local latencyWorldText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_FORMAT"], perf_stats.latencyWorld);
+		local bandwidthInText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_BANDWIDTH_FORMAT"], perf_stats.bandwidthIn);
+		local bandwidthOutText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_BANDWIDTH_FORMAT"], perf_stats.bandwidthOut);

 		GameTooltip:AddLine("\n");
 		GameTooltip:AddLine(TitanUtils_GetHighlightText(L["TITAN_PANEL_PERFORMANCE_LATENCY_TOOLTIP"]));
-		if showLatency then GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_LATENCY_TOOLTIP_LATENCY_HOME"], TitanUtils_GetHighlightText(latencyText)); end
-		if showWorldLatency then GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_LATENCY_TOOLTIP_LATENCY_WORLD"], TitanUtils_GetHighlightText(latencyWorldText)); end
-		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_LATENCY_TOOLTIP_BANDWIDTH_IN"], TitanUtils_GetHighlightText(bandwidthInText));
-		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_LATENCY_TOOLTIP_BANDWIDTH_OUT"], TitanUtils_GetHighlightText(bandwidthOutText));
+		if showLatency then GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_LATENCY_TOOLTIP_LATENCY_HOME"],
+				TitanUtils_GetHighlightText(latencyText)); end
+		if showWorldLatency then GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_LATENCY_TOOLTIP_LATENCY_WORLD"],
+				TitanUtils_GetHighlightText(latencyWorldText)); end
+		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_LATENCY_TOOLTIP_BANDWIDTH_IN"],
+			TitanUtils_GetHighlightText(bandwidthInText));
+		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_LATENCY_TOOLTIP_BANDWIDTH_OUT"],
+			TitanUtils_GetHighlightText(bandwidthOutText));
 	end

 	-- Memory tooltip
-	if ( showMemory ) then
-		local memoryText = format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], button.memory/1024);
-		local initialMemoryText = format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], button.initialMemory/1024);
-		local sessionTime = time() - button.startSessionTime;
+	if (showMemory) then
+		local memoryText = format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], perf_stats.memory / 1024);
+		local initialMemoryText = format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], perf_stats.initialMemory / 1024);
+		local sessionTime = time() - perf_stats.startSessionTime;
 		local rateRichText, timeToGCRichText, rate, timeToGC, color;
-		if ( sessionTime == 0 ) then
+		if (sessionTime == 0) then
 			rateRichText = TitanUtils_GetHighlightText("N/A");
 		else
-			rate = (button.memory - button.initialMemory) / sessionTime;
+			rate = (perf_stats.memory - perf_stats.initialMemory) / sessionTime;
 			color = TitanUtils_GetThresholdColor(TITAN_MEMORY_RATE_THRESHOLD_TABLE, rate);
 			rateRichText = TitanUtils_GetColoredText(format(L["TITAN_PANEL_PERFORMANCE_MEMORY_RATE_FORMAT"], rate), color)
 		end
-		if ( button.memory == button.initialMemory ) then
+		if (perf_stats.memory == perf_stats.initialMemory) then
 			timeToGCRichText = TitanUtils_GetHighlightText("N/A");
 		end

 		GameTooltip:AddLine("\n");
 		GameTooltip:AddLine(TitanUtils_GetHighlightText(L["TITAN_PANEL_PERFORMANCE_MEMORY_TOOLTIP"]));
-		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_MEMORY_TOOLTIP_CURRENT_MEMORY"], TitanUtils_GetHighlightText(memoryText));
-		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_MEMORY_TOOLTIP_INITIAL_MEMORY"], TitanUtils_GetHighlightText(initialMemoryText));
+		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_MEMORY_TOOLTIP_CURRENT_MEMORY"],
+			TitanUtils_GetHighlightText(memoryText));
+		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_MEMORY_TOOLTIP_INITIAL_MEMORY"],
+			TitanUtils_GetHighlightText(initialMemoryText));
 		GameTooltip:AddDoubleLine(L["TITAN_PANEL_PERFORMANCE_MEMORY_TOOLTIP_INCREASING_RATE"], rateRichText);
 	end

-	if ( showAddonMemory == 1 ) then
-		for _,i in pairs(topAddOns) do
+	if (showAddonMemory == 1) then
+		for _, i in pairs(topAddOns) do
 			i.name = '';
 			i.value = 0;
 		end
@@ -260,14 +299,9 @@ local function SetTooltip()
 	GameTooltip:AddLine(TitanUtils_GetGreenText(L["TITAN_PERFORMANCE_TOOLTIP_HINT"]));
 end

---[[
--- **************************************************************************
--- NAME : UpdateData()
--- DESC : Update button data
--- **************************************************************************
---]]
+---local Update real-time data, placing it on the plugin frame
 local function UpdateData()
-	local button = _G["TitanPanelPerformanceButton"];
+	--	local button = _G["TitanPanelPerformanceButton"];
 	local showFPS = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowFPS");
 	local showLatency = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowLatency");
 	local showWorldLatency = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowWorldLatency")
@@ -275,47 +309,48 @@ local function UpdateData()
 	local showAddonMemory = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowAddonMemory");

 	-- FPS Data
-	if ( showFPS ) then
-		button.fps = GetFramerate();
-		button.fpsSampleCount = button.fpsSampleCount + 1;
-		if (button.fpsSampleCount == 1) then
-			button.minFPS = button.fps;
-			button.maxFPS = button.fps;
-			button.avgFPS = button.fps;
+	if (showFPS) then
+		perf_stats.fps = GetFramerate();
+		perf_stats.fpsSampleCount = perf_stats.fpsSampleCount + 1;
+		if (perf_stats.fpsSampleCount == 1) then
+			perf_stats.minFPS = perf_stats.fps;
+			perf_stats.maxFPS = perf_stats.fps;
+			perf_stats.avgFPS = perf_stats.fps;
 		else
-			if (button.fps < button.minFPS) then
-				button.minFPS = button.fps;
-			elseif (button.fps > button.maxFPS) then
-				button.maxFPS = button.fps;
+			if (perf_stats.fps < perf_stats.minFPS) then
+				perf_stats.minFPS = perf_stats.fps;
+			elseif (perf_stats.fps > perf_stats.maxFPS) then
+				perf_stats.maxFPS = perf_stats.fps;
 			end
-			button.avgFPS = (button.avgFPS * (button.fpsSampleCount - 1) + button.fps) / button.fpsSampleCount;
+			perf_stats.avgFPS = (perf_stats.avgFPS * (perf_stats.fpsSampleCount - 1) + perf_stats.fps) /
+			perf_stats.fpsSampleCount;
 		end
 	end

 	-- Latency Data
-	if ( showLatency or showWorldLatency ) then
+	if (showLatency or showWorldLatency) then
 		-- bandwidthIn, bandwidthOut, latencyHome, latencyWorld = GetNetStats();
-		button.bandwidthIn, button.bandwidthOut, button.latencyHome, button.latencyWorld = GetNetStats();
+		perf_stats.bandwidthIn, perf_stats.bandwidthOut, perf_stats.latencyHome, perf_stats.latencyWorld = GetNetStats();
 	end

 	-- Memory data
-	if ( showMemory ) or (showAddonMemory == 1) then
-		local previousMemory = button.memory;
-		button.memory, button.gcThreshold = gcinfo();
-		if ( not button.startSessionTime ) then
+	if (showMemory) or (showAddonMemory == 1) then
+		local previousMemory = perf_stats.memory;
+		perf_stats.memory, perf_stats.gcThreshold = gcinfo();
+		if (not perf_stats.startSessionTime) then
 			-- Initial data
 			local i;
-			button.startSessionTime = time();
-			button.initialMemory = button.memory;
+			perf_stats.startSessionTime = time();
+			perf_stats.initialMemory = perf_stats.memory;

 			for i = 1, NumAddons() do
 				memUsageSinceGC[AddOnInfo(i)] = GetAddOnMemoryUsage(i)
 			end
-		elseif (previousMemory and button.memory and previousMemory > button.memory) then
+		elseif (previousMemory and perf_stats.memory and previousMemory > perf_stats.memory) then
 			-- Reset data after garbage collection
-			local k,i;
-			button.startSessionTime = time();
-			button.initialMemory = button.memory;
+			local k, i;
+			perf_stats.startSessionTime = time();
+			perf_stats.initialMemory = perf_stats.memory;

 			for k in pairs(memUsageSinceGC) do
 				memUsageSinceGC[k] = nil
@@ -328,15 +363,16 @@ local function UpdateData()
 	end
 end

---[[
--- **************************************************************************
--- NAME : GetButtonText(id)
--- DESC : Calculate performance based logic for button text
--- VARS : id = button ID
--- **************************************************************************
---]]
+---local Generate button text using data on the plugin frame
+---@param id string
+---@return string label
+---@return string plugin_text
+---@return string | nil label2
+---@return string | nil plugin_text2
+---@return string | nil label3
+---@return string | nil plugin_text3
 local function GetButtonText(id)
-	local button = _G["TitanPanelPerformanceButton"];
+	--	local button = _G["TitanPanelPerformanceButton"];
 	local color, fpsRichText, latencyRichText, memoryRichText;
 	local showFPS = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowFPS");
 	local showLatency = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowLatency");
@@ -347,10 +383,10 @@ local function GetButtonText(id)
 	UpdateData()

 	-- FPS text
-	if ( showFPS ) then
-		local fpsText = format(L["TITAN_PANEL_PERFORMANCE_FPS_FORMAT"], button.fps);
-		if ( TitanGetVar(TITAN_PERFORMANCE_ID, "ShowColoredText") ) then
-			color = TitanUtils_GetThresholdColor(TITAN_FPS_THRESHOLD_TABLE, button.fps);
+	if (showFPS) then
+		local fpsText = format(L["TITAN_PANEL_PERFORMANCE_FPS_FORMAT"], perf_stats.fps);
+		if (TitanGetVar(TITAN_PERFORMANCE_ID, "ShowColoredText")) then
+			color = TitanUtils_GetThresholdColor(TITAN_FPS_THRESHOLD_TABLE, perf_stats.fps);
 			fpsRichText = TitanUtils_GetColoredText(fpsText, color);
 		else
 			fpsRichText = TitanUtils_GetHighlightText(fpsText);
@@ -359,76 +395,76 @@ local function GetButtonText(id)

 	-- Latency text
 	latencyRichText = ""
-	if ( showLatency ) then
-		local latencyText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_FORMAT"], button.latencyHome);
-		if ( TitanGetVar(TITAN_PERFORMANCE_ID, "ShowColoredText") ) then
-			color = TitanUtils_GetThresholdColor(TITAN_LATENCY_THRESHOLD_TABLE, button.latencyHome);
+	if (showLatency) then
+		local latencyText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_FORMAT"], perf_stats.latencyHome);
+		if (TitanGetVar(TITAN_PERFORMANCE_ID, "ShowColoredText")) then
+			color = TitanUtils_GetThresholdColor(TITAN_LATENCY_THRESHOLD_TABLE, perf_stats.latencyHome);
 			latencyRichText = TitanUtils_GetColoredText(latencyText, color);
 		else
 			latencyRichText = TitanUtils_GetHighlightText(latencyText)
 		end
 	end

-	if ( showWorldLatency  ) then
-		local latencyWorldText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_FORMAT"], button.latencyWorld);
-		if ( showLatency ) then
-			latencyRichText = latencyRichText.."/"
+	if (showWorldLatency) then
+		local latencyWorldText = format(L["TITAN_PANEL_PERFORMANCE_LATENCY_FORMAT"], perf_stats.latencyWorld);
+		if (showLatency) then
+			latencyRichText = latencyRichText .. "/"
 		end
-		if ( TitanGetVar(TITAN_PERFORMANCE_ID, "ShowColoredText") ) then
-			color = TitanUtils_GetThresholdColor(TITAN_LATENCY_THRESHOLD_TABLE, button.latencyWorld);
-			latencyRichText = latencyRichText..TitanUtils_GetColoredText(latencyWorldText, color);
+		if (TitanGetVar(TITAN_PERFORMANCE_ID, "ShowColoredText")) then
+			color = TitanUtils_GetThresholdColor(TITAN_LATENCY_THRESHOLD_TABLE, perf_stats.latencyWorld);
+			latencyRichText = latencyRichText .. TitanUtils_GetColoredText(latencyWorldText, color);
 		else
-			latencyRichText = latencyRichText..TitanUtils_GetHighlightText(latencyWorldText);
+			latencyRichText = latencyRichText .. TitanUtils_GetHighlightText(latencyWorldText);
 		end
 	end

 	-- Memory text
-	if ( showMemory ) then
-		local memoryText = format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], button.memory/1024);
+	if (showMemory) then
+		local memoryText = format(L["TITAN_PANEL_PERFORMANCE_MEMORY_FORMAT"], perf_stats.memory / 1024);
 		memoryRichText = TitanUtils_GetHighlightText(memoryText);
 	end

-	if ( showFPS ) then
-		if ( showLatency or showWorldLatency ) then
-			if ( showMemory ) then
-				return L["TITAN_PANEL_PERFORMANCE_FPS_BUTTON_LABEL"], fpsRichText, L["TITAN_PANEL_PERFORMANCE_LATENCY_BUTTON_LABEL"], latencyRichText, L["TITAN_PANEL_PERFORMANCE_MEMORY_BUTTON_LABEL"], memoryRichText;
+	if (showFPS) then
+		if (showLatency or showWorldLatency) then
+			if (showMemory) then
+				return L["TITAN_PANEL_PERFORMANCE_FPS_BUTTON_LABEL"], fpsRichText,
+					L["TITAN_PANEL_PERFORMANCE_LATENCY_BUTTON_LABEL"], latencyRichText,
+					L["TITAN_PANEL_PERFORMANCE_MEMORY_BUTTON_LABEL"], memoryRichText;
 			else
-				return L["TITAN_PANEL_PERFORMANCE_FPS_BUTTON_LABEL"], fpsRichText, L["TITAN_PANEL_PERFORMANCE_LATENCY_BUTTON_LABEL"], latencyRichText;
+				return L["TITAN_PANEL_PERFORMANCE_FPS_BUTTON_LABEL"], fpsRichText,
+					L["TITAN_PANEL_PERFORMANCE_LATENCY_BUTTON_LABEL"], latencyRichText;
 			end
 		else
-			if ( showMemory ) then
-				return L["TITAN_PANEL_PERFORMANCE_FPS_BUTTON_LABEL"], fpsRichText, L["TITAN_PANEL_PERFORMANCE_MEMORY_BUTTON_LABEL"], memoryRichText;
+			if (showMemory) then
+				return L["TITAN_PANEL_PERFORMANCE_FPS_BUTTON_LABEL"], fpsRichText,
+					L["TITAN_PANEL_PERFORMANCE_MEMORY_BUTTON_LABEL"], memoryRichText;
 			else
 				return L["TITAN_PANEL_PERFORMANCE_FPS_BUTTON_LABEL"], fpsRichText;
 			end
 		end
 	else
-		if ( showLatency or showWorldLatency ) then
-			if ( showMemory ) then
-				return L["TITAN_PANEL_PERFORMANCE_LATENCY_BUTTON_LABEL"], latencyRichText, L["TITAN_PANEL_PERFORMANCE_MEMORY_BUTTON_LABEL"], memoryRichText;
+		if (showLatency or showWorldLatency) then
+			if (showMemory) then
+				return L["TITAN_PANEL_PERFORMANCE_LATENCY_BUTTON_LABEL"], latencyRichText,
+					L["TITAN_PANEL_PERFORMANCE_MEMORY_BUTTON_LABEL"], memoryRichText;
 			else
 				return L["TITAN_PANEL_PERFORMANCE_LATENCY_BUTTON_LABEL"], latencyRichText;
 			end
 		else
-			if ( showMemory ) then
+			if (showMemory) then
 				return L["TITAN_PANEL_PERFORMANCE_MEMORY_BUTTON_LABEL"], memoryRichText;
 			else
-				return;
+				return "", ""
 			end
 		end
 	end
 end

---[[
--- **************************************************************************
--- NAME : CreateMenu()
--- DESC : Display rightclick menu options
--- **************************************************************************
---]]
+---local Display Right click menu options
 local function CreateMenu()
 	local info

---[[
+	--[[
 print("TPref"
 .." "..tostring(TitanPanelRightClickMenu_GetDropdownLevel())..""
 .." "..tostring(TitanPanelRightClickMenu_GetDropdMenuValue())..""
@@ -445,7 +481,7 @@ print("TPref"
 		if TitanPanelRightClickMenu_GetDropdMenuValue() == "Options" then
 			TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_OPTIONS"], TitanPanelRightClickMenu_GetDropdownLevel());

-			local temptable = {TITAN_PERFORMANCE_ID, "ShowFPS"};
+			local temptable = { TITAN_PERFORMANCE_ID, "ShowFPS" };
 			info = {};
 			info.text = L["TITAN_PERFORMANCE_MENU_SHOW_FPS"];
 			info.value = temptable;
@@ -456,7 +492,7 @@ print("TPref"
 			info.keepShownOnClick = 1;
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());

-			local temptable = {TITAN_PERFORMANCE_ID, "ShowLatency"};
+			local temptable = { TITAN_PERFORMANCE_ID, "ShowLatency" };
 			info = {};
 			info.text = L["TITAN_PERFORMANCE_MENU_SHOW_LATENCY"];
 			info.value = temptable;
@@ -467,7 +503,7 @@ print("TPref"
 			info.keepShownOnClick = 1;
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());

-			local temptable = {TITAN_PERFORMANCE_ID, "ShowWorldLatency"};
+			local temptable = { TITAN_PERFORMANCE_ID, "ShowWorldLatency" };
 			info = {};
 			info.text = L["TITAN_PERFORMANCE_MENU_SHOW_LATENCY_WORLD"];
 			info.value = temptable;
@@ -478,7 +514,7 @@ print("TPref"
 			info.keepShownOnClick = 1;
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());

-			local temptable = {TITAN_PERFORMANCE_ID, "ShowMemory"};
+			local temptable = { TITAN_PERFORMANCE_ID, "ShowMemory" };
 			info = {};
 			info.text = L["TITAN_PERFORMANCE_MENU_SHOW_MEMORY"];
 			info.value = temptable;
@@ -493,7 +529,7 @@ print("TPref"
 		if TitanPanelRightClickMenu_GetDropdMenuValue() == "AddonUsage" then
 			TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_ADDONS"], TitanPanelRightClickMenu_GetDropdownLevel());

-			local temptable = {TITAN_PERFORMANCE_ID, "ShowAddonMemory"};
+			local temptable = { TITAN_PERFORMANCE_ID, "ShowAddonMemory" };
 			info = {};
 			info.text = L["TITAN_PERFORMANCE_MENU_SHOW_ADDONS"];
 			info.value = temptable;
@@ -504,7 +540,7 @@ print("TPref"
 			info.keepShownOnClick = 1;
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());

-			local temptable = {TITAN_PERFORMANCE_ID, "ShowAddonIncRate"};
+			local temptable = { TITAN_PERFORMANCE_ID, "ShowAddonIncRate" };
 			info = {};
 			info.text = L["TITAN_PERFORMANCE_MENU_SHOW_ADDON_RATE"];
 			info.value = temptable;
@@ -518,40 +554,55 @@ print("TPref"
 			info = {};
 			info.notCheckable = true
 			info.text = L["TITAN_PERFORMANCE_CONTROL_TOOLTIP"]
-				..LIGHTYELLOW_FONT_COLOR_CODE..tostring(TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons"));
+				.. LIGHTYELLOW_FONT_COLOR_CODE .. tostring(TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons"));
 			info.value = "AddonControlFrame"
 			info.hasArrow = 1;
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 		end

 		if TitanPanelRightClickMenu_GetDropdMenuValue() == "AddonMemoryFormat" then
-			TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_ADDON_MEM_FORMAT_LABEL"], TitanPanelRightClickMenu_GetDropdownLevel());
+			TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_ADDON_MEM_FORMAT_LABEL"],
+				TitanPanelRightClickMenu_GetDropdownLevel());
 			info = {};
 			info.text = L["TITAN_PANEL_MEGABYTE"];
-			info.checked = function() if TitanGetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType") == 1 then return true else return nil end
+			info.checked = function()
+				if TitanGetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType") == 1 then return true else return nil end
 			end
 			info.func = function() TitanSetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType", 1) end
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 			info = {};
 			info.text = L["TITAN_PANEL_PERFORMANCE_MEMORY_KBMB_LABEL"];
-			info.checked = function() if TitanGetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType") == 2 then return true else return nil end
+			info.checked = function()
+				if TitanGetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType") == 2 then return true else return nil end
 			end
 			info.func = function() TitanSetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType", 2) end
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 		end

 		if TitanPanelRightClickMenu_GetDropdMenuValue() == "CPUProfiling" then
-			if ( GetCVar("scriptProfile") == "1" ) then
-				TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL"]..": "..GREEN_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_ENABLED"], TitanPanelRightClickMenu_GetDropdownLevel());
+			if (GetCVar("scriptProfile") == "1") then
+				TitanPanelRightClickMenu_AddTitle(
+				L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL"] .. ": " .. GREEN_FONT_COLOR_CODE ..
+				L["TITAN_PANEL_MENU_ENABLED"], TitanPanelRightClickMenu_GetDropdownLevel());
 				info = {};
-				info.text = L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL_OFF"]..GREEN_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_RELOADUI"];
-				info.func = function() SetCVar("scriptProfile", "0") ReloadUI() end
+				info.text = L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL_OFF"] ..
+				GREEN_FONT_COLOR_CODE .. L["TITAN_PANEL_MENU_RELOADUI"];
+				info.func = function()
+					SetCVar("scriptProfile", "0")
+					ReloadUI()
+				end
 				TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 			else
-				TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL"]..": "..RED_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_DISABLED"], TitanPanelRightClickMenu_GetDropdownLevel());
+				TitanPanelRightClickMenu_AddTitle(
+				L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL"] .. ": " .. RED_FONT_COLOR_CODE ..
+				L["TITAN_PANEL_MENU_DISABLED"], TitanPanelRightClickMenu_GetDropdownLevel());
 				info = {};
-				info.text = L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL_ON"]..GREEN_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_RELOADUI"];
-				info.func = function() SetCVar("scriptProfile", "1") ReloadUI() end
+				info.text = L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL_ON"] ..
+				GREEN_FONT_COLOR_CODE .. L["TITAN_PANEL_MENU_RELOADUI"];
+				info.func = function()
+					SetCVar("scriptProfile", "1")
+					ReloadUI()
+				end
 				TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 			end
 		end
@@ -592,24 +643,20 @@ print("TPref"
 	TitanPanelRightClickMenu_AddControlVars(TITAN_PERFORMANCE_ID)
 end

---[[
--- **************************************************************************
--- NAME : OnLoad()
--- DESC : Registers the plugin upon it loading
--- **************************************************************************
---]]
+---local Create plugin .registry and and init some variables and register for first events
+---@param self Button
 local function OnLoad(self)
 	local notes = ""
-		.."Adds FPS (Frames Per Second) and Garbage collection information to Titan Panel.\n"
---		.."- xxx.\n"
+		.. "Adds FPS (Frames Per Second) and Garbage collection information to Titan Panel.\n"
+	--		.."- xxx.\n"
 	self.registry = {
 		id = TITAN_PERFORMANCE_ID,
 		category = "Built-ins",
 		version = TITAN_VERSION,
 		menuText = L["TITAN_PERFORMANCE_MENU_TEXT"],
 		menuTextFunction = CreateMenu,
-		buttonTextFunction = GetButtonText;
-		tooltipCustomFunction = SetTooltip;
+		buttonTextFunction = GetButtonText,
+		tooltipCustomFunction = SetTooltip,
 		icon = "Interface\\AddOns\\TitanPerformance\\TitanPerformance",
 		iconWidth = 16,
 		notes = notes,
@@ -636,58 +683,50 @@ local function OnLoad(self)
 		}
 	};

-	self.fpsSampleCount = 0;
+	perf_stats.fpsSampleCount = 0
 	self:RegisterEvent("PLAYER_ENTERING_WORLD");
 end

-function OnHide()
+---local Hide the plugin and stop timers
+local function OnHide()
 	AceTimer:CancelTimer(PerfTimer)
 	PerfTimerRunning = false
 end

---[[
--- **************************************************************************
--- NAME : TitanPanelPerformanceButton_OnUpdate(elapsed)
--- DESC : Update button data
--- VARS : elapsed = <research>
--- **************************************************************************
---]]
-function TitanPanelPerformanceButtonHandle_OnUpdate()
+---local Update button data
+local function TitanPanelPerformanceButtonHandle_OnUpdate()
 	TitanPanelPluginHandle_OnUpdate(updateTable);
 	if not (TitanPanelRightClickMenu_IsVisible()) and _G["TitanPanelPerfControlFrame"]:IsVisible() and not (MouseIsOver(_G["TitanPanelPerfControlFrame"])) then
 		_G["TitanPanelPerfControlFrame"]:Hide();
 	end
 end

+---local Show the plugin and start timers
 local function OnShow()
 	if PerfTimerRunning then
 		-- Do not create a new one
 	else
-		PerfTimer = AceTimer:ScheduleRepeatingTimer(TitanPanelPerformanceButtonHandle_OnUpdate, 1.5 )
+		PerfTimer = AceTimer:ScheduleRepeatingTimer(TitanPanelPerformanceButtonHandle_OnUpdate, 1.5)
 		PerfTimerRunning = true
 	end
 end

+---local Handle events registered to plugin
+---@param self Button
+---@param event string
+---@param ... any
 local function OnEvent(self, event, ...)
 	if event == "PLAYER_ENTERING_WORLD" then
-		local i;
 		topAddOns = {}
 		-- scan how many addons are active
 		local count = NumAddons();
 		local ActiveAddons = 0;
 		local NumOfAddons = TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons");
---[[
-Urnati - This was a kludge as I believe there was a conflict with other addons loading Ace3
-libraries as TitanGetVar is misbehaving.  As such, I added the local NumOfAddons above
-and added the following four lines of code looking for a nil when it shouldn't return
-as the value defaults to 5.
-I also added NumOfAddons below the TitanDebug to avoid the problem later on.
-]]
 		if NumOfAddons == nil then
 			NumOfAddons = 5;
 			TitanSetVar(TITAN_PERFORMANCE_ID, "NumOfAddons", 5);
 		end
-		for i=1, count do
+		for i = 1, count do
 			if IsAddOnLoaded(i) then
 				ActiveAddons = ActiveAddons + 1;
 			end
@@ -699,80 +738,52 @@ I also added NumOfAddons below the TitanDebug to avoid the problem later on.
 			counter = NumOfAddons;
 		end
 		--set the counter to the proper number of active addons that are being monitored
-		for i=1, counter do
-			topAddOns[i] = {name = '', value = 0}
+		for i = 1, counter do
+			topAddOns[i] = { name = '', value = 0 }
 		end
 	end
 end

---[[
--- **************************************************************************
--- NAME : TitanPanelPerformanceButton_ResetMemory()
--- DESC : Reset the memory monitoring values
--- **************************************************************************
---function TitanPanelPerformanceButton_ResetMemory()
-	-- local button = _G["TitanPanelPerformanceButton"];
-	--button.memory, button.gcThreshold = gcinfo();
-	--button.initialMemory = button.memory;
-	--button.startSessionTime = time();
---end
---]]
-
---[[
--- **************************************************************************
--- NAME : TitanPanelPerformanceButton_OnClick()
--- DESC : Execute garbage collection for Leftclick on button
--- **************************************************************************
---]]
+---local Handle mouse click events registered to plugin; Left click is garbage collection
+---@param self Button
+---@param button string
 local function OnClick(self, button)
 	if button == "LeftButton" then
 		collectgarbage('collect');
 	end
 end

---[[
--- **************************************************************************
--- NAME : Slider_OnEnter()
--- DESC : Display tooltip on entering slider
--- **************************************************************************
---]]
+---local Position tooltip over slider control
+---@param self Button
 local function Slider_OnEnter(self)
-	self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_PERFORMANCE_CONTROL_TOOLTIP"], TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons"));
+	self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_PERFORMANCE_CONTROL_TOOLTIP"],
+		TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons"));
 	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
 	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
 end

---[[
--- **************************************************************************
--- NAME : Slider_OnLeave()
--- DESC : Hide tooltip after leaving slider
--- **************************************************************************
---]]
+---local Hide tooltip after leaving slider
+---@param self Button
 local function Slider_OnLeave(self)
 	self.tooltipText = nil;
 	GameTooltip:Hide();
 end

---[[
--- **************************************************************************
--- NAME : Slider_OnShow()
--- DESC : Display slider tooltip
--- **************************************************************************
---]]
+---local Generate tooltip over slider control
+---@param self Slider plugin slider frame
 local function Slider_OnShow(self)
-
-	_G[self:GetName().."Text"]:SetText(TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons"));
-	_G[self:GetName().."High"]:SetText(L["TITAN_PERFORMANCE_CONTROL_LOW"]);
-	_G[self:GetName().."Low"]:SetText(L["TITAN_PERFORMANCE_CONTROL_HIGH"]);
+	_G[self:GetName() .. "Text"]:SetText(TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons"));
+	_G[self:GetName() .. "High"]:SetText(L["TITAN_PERFORMANCE_CONTROL_LOW"]);
+	_G[self:GetName() .. "Low"]:SetText(L["TITAN_PERFORMANCE_CONTROL_HIGH"]);
 	self:SetMinMaxValues(APP_MIN, APP_MAX);
 	self:SetValueStep(1);
 	self:SetObeyStepOnDrag(true) -- since 5.4.2 (Mists of Pandaria)
 	self:SetValue(CalcAppNum(TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons")));

 	local lev = TitanPanelRightClickMenu_GetDropdownLevel() - 1
-	local dds = TitanPanelRightClickMenu_GetDropdownFrameBase()..tostring(lev)
+	local dds = TitanPanelRightClickMenu_GetDropdownFrameBase() .. tostring(lev)
 	local drop_down = _G[dds]
---	local scale = TitanPanelPerfControlFrame:GetScale()
+	--	local scale = TitanPanelPerfControlFrame:GetScale()
 	TitanPanelPerfControlFrame:ClearAllPoints();
 	TitanPanelPerfControlFrame:SetPoint("LEFT", drop_down, "RIGHT", 0, 0);
 	local offscreenX, offscreenY = TitanUtils_GetOffscreen(TitanPanelPerfControlFrame);
@@ -784,8 +795,8 @@ local function Slider_OnShow(self)
 		TitanPanelPerfControlFrame:SetPoint("RIGHT", drop_down, "LEFT", 0, 0);
 	end

---[[
-	local top_point, top_rel_to, top_rel_point, top_x, top_y =
+	--[[
+	local top_point, top_rel_to, top_rel_point, top_x, top_y =
 		TitanPanelPerfControlFrame:GetPoint(TitanPanelPerfControlFrame:GetNumPoints())
 print("TPref"
 .." "..tostring(drop_down:GetName())..""
@@ -802,18 +813,14 @@ print("TPref"
 --]]
 end

---[[
--- **************************************************************************
--- NAME : Slider_OnValueChanged(arg1)
--- DESC : Display slider tooltip text
--- VARS : arg1 = positive or negative change to apply
--- **************************************************************************
---]]
+---local Display slider tooltip text
+---@param self Slider plugin slider frame
+---@param a1 number positive or negative change to apply
 local function Slider_OnValueChanged(self, a1)
 	local val = CalcAppNum(self:GetValue()) -- grab new value

-	_G[self:GetName().."Text"]:SetText(val);
---[[
+	_G[self:GetName() .. "Text"]:SetText(val);
+	--[[
 	if a1 == -1 then
 		self:SetValue(self:GetValue() + 1);
 	end
@@ -824,12 +831,11 @@ local function Slider_OnValueChanged(self, a1)
 --]]
 	TitanSetVar(TITAN_PERFORMANCE_ID, "NumOfAddons", val);

-	local i;
 	topAddOns = {};
 	-- scan how many addons are active
 	local count = NumAddons();
 	local ActiveAddons = 0;
-	for i=1, count do
+	for i = 1, count do
 		if IsAddOnLoaded(i) then
 			ActiveAddons = ActiveAddons + 1;
 		end
@@ -842,69 +848,53 @@ local function Slider_OnValueChanged(self, a1)
 	end

 	--set the counter to the proper number of active addons that are being monitored
-	for i=1, counter do
-		topAddOns[i] = {name = '', value = 0}
+	for idx = 1, counter do
+		topAddOns[idx] = { name = '', value = 0 }
 	end

 	-- Update GameTooltip
-	if (self.tooltipText) then
-		self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_PERFORMANCE_CONTROL_TOOLTIP"], tostring(val))
-		GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
+	if (perf_stats.tooltipText) then
+		perf_stats.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_PERFORMANCE_CONTROL_TOOLTIP"], tostring(val))
+		GameTooltip:SetText(perf_stats.tooltipText, nil, nil, nil, nil, 1);
 	end
 end

---[[
--- **************************************************************************
--- NAME : Control_OnLoad()
--- DESC : Create performance option frame
--- **************************************************************************
---]]
+---local Create performance menu / control frame
+---@param self Frame
 local function Control_OnLoad(self)
-	_G[self:GetName().."Title"]:SetText(L["TITAN_PERFORMANCE_CONTROL_TITLE"]);
---[[
-Blizzard decided to remove direct Backdrop API in 9.0 (Shadowlands)
-so inherit the template (XML) and set the values in the code (Lua)
-
-9.5 The tooltip template was removed from the GameTooltip.
---]]
+	_G[self:GetName() .. "Title"]:SetText(L["TITAN_PERFORMANCE_CONTROL_TITLE"]);
 	TitanPanelRightClickMenu_SetCustomBackdrop(self)
 end

---[[
--- **************************************************************************
--- NAME : Control_OnUpdate(elapsed)
--- DESC : If dropdown is visible, see if its timer has expired.  If so, hide frame
--- VARS : elapsed = <research>
--- **************************************************************************
---]]
+---local If dropdown is visible, see if its timer has expired.  If expired, hide frame.
+---@param self Frame
+---@param elapsed number
 local function Control_OnUpdate(self, elapsed)
-	local drop_down = TitanPanelRightClickMenu_GetDropdownFrame()
-
+	--	local drop_down = TitanPanelRightClickMenu_GetDropdownFrame()
+
 	if not MouseIsOver(_G["TitanPanelPerfControlFrame"])
---	and not MouseIsOver (_G[drop_down.."2Button4"])
---	and not MouseIsOver (_G[drop_down.."2Button4ExpandArrow"])
 	then
 		TitanUtils_CheckFrameCounting(self, elapsed);
 	end
 end

--- ====== Create needed frames
+---local Create needed frames
 local function Create_Frames()
 	if _G[TITAN_BUTTON] then
 		return -- if already created
 	end
-
+
 	-- general container frame
 	local f = CreateFrame("Frame", nil, UIParent)
---	f:Hide()
+	--	f:Hide()

 	-- Titan plugin button
 	local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelComboTemplate")
 	window:SetFrameStrata("FULLSCREEN")
 	-- Using SetScript("OnLoad",   does not work
 	OnLoad(window);
---	TitanPanelButton_OnLoad(window); -- Titan XML template calls this...
-
+	--	TitanPanelButton_OnLoad(window); -- Titan XML template calls this...
+
 	window:SetScript("OnShow", function(self)
 		OnShow()
 		TitanPanelButton_OnShow(self)
@@ -913,7 +903,7 @@ local function Create_Frames()
 		OnHide()
 	end)
 	window:SetScript("OnEvent", function(self, event, ...)
-		OnEvent(self, event, ...)
+		OnEvent(self, event, ...)
 	end)
 	window:SetScript("OnClick", function(self, button)
 		OnClick(self, button)
@@ -921,7 +911,7 @@ local function Create_Frames()
 	end)


----[===[
+	---[===[
 	-- Config screen
 	local cname = "TitanPanelPerfControlFrame"
 	local config = CreateFrame("Frame", cname, f, BackdropTemplateMixin and "BackdropTemplate")
@@ -939,11 +929,11 @@ local function Create_Frames()
 	config:SetScript("OnUpdate", function(self, elapsed)
 		Control_OnUpdate(self, elapsed)
 	end)
-
+
 	-- Config Title
 	local str = nil
 	local style = "GameFontNormalSmall"
-	str = config:CreateFontString(cname.."Title", "ARTWORK", style)
+	str = config:CreateFontString(cname .. "Title", "ARTWORK", style)
 	str:SetPoint("TOP", config, 0, -10)

 	-- Config slider sections
@@ -972,7 +962,7 @@ local function Create_Frames()
 	-- Now that the parts exist, initialize
 	Control_OnLoad(config)

---]===]
+	--]===]
 end


diff --git a/TitanRepair/TitanRepair.lua b/TitanRepair/TitanRepair.lua
index 56f31f3..3a25137 100644
--- a/TitanRepair/TitanRepair.lua
+++ b/TitanRepair/TitanRepair.lua
@@ -108,13 +108,8 @@ TR.show_debug_tooltip = false -- shows items processed during scan

 -- ******************************** Functions *******************************

---[[ local
--- **************************************************************************
--- NAME : debug_msg(Message)
--- DESC : Debug function to print message to chat frame
--- VARS : Message = message to print to chat frame
--- **************************************************************************
---]]
+---local Debug function to print message to chat frame.
+---@param Message string
 local function debug_msg(Message)
 	local msg = ""
 	local stamp = date("%H:%M:%S") -- date("%m/%d/%y %H:%M:%S")
@@ -126,13 +121,7 @@ local function debug_msg(Message)
 --		DEFAULT_CHAT_FRAME:AddMessage(TITAN_REPAIR_ID..": " .. Message, 1.00, 0.49, 0.04)
 end

---[[ local
--- **************************************************************************
--- NAME : RepairInit()
--- DESC : Reset the tables and variables to default values
--- VARS : None
--- **************************************************************************
---]]
+---local Reset plugin tables and variables to default values
 local function RepairInit()
 	TR.repair_total = 0
 	TR.repair_bags = { cur = 0, max = 0, dur = 0, total = 0 }
@@ -169,13 +158,17 @@ end
 -- int : repair cost or 0
 -- **************************************************************************
 --]]
+---local Assuming an equipped item, get repair cost
+---@param slotName string For debug
+---@param slot number
+---@return boolean
+---@return number
 local function GetRepairCostEquip(slotName, slot)
 	local equipped = false
 	local res = 0
 	local name = ""

 	--Blizz changed SetInventoryItem for DragonFlight
-	-- use a proxy for retail (true) versus classic (false)
 	if C_TooltipInfo then
 		local data = C_TooltipInfo.GetInventoryItem("player", slot)
 		if data then
@@ -183,53 +176,39 @@ local function GetRepairCostEquip(slotName, slot)
 			res = (data.repairCost or 0)
 			equipped = true
 		end
-	else
+	else -- Classic
 		TitanRepairTooltip:SetOwner(UIParent, "ANCHOR_NONE");
 		TitanRepairTooltip:ClearLines()

-		local _, itemRarity, itemType, itemSubType
-		-- Had to change the lookup for Classic. Could not find the right lookup text for ranged so used the constants
-		-- instead. The slot in the array above was changed to match.
 		local hasItem, _, repairCost = TitanRepairTooltip:SetInventoryItem("player", slot)
 		res = repairCost

-		-- debug
-		if hasItem then
-			equipped = true
-		else
-			name = ""
-			equipped = false
-		end
+		equipped = hasItem -- debug
+
 		TitanRepairTooltip:Hide()
 	end

---[[
-print("TRepair eq cost"
-	.." "..tostring(equipped)..""
-	.." "..tostring(res)..""
-	.." "..tostring(slot)..""
-	.."["..tostring(slotName).."]"
-	.." '"..tostring(name).."'"
---]]
+	if (TR.show_debug) then
+		local msg = "TRepair eq cost"
+		.." equipped : "..tostring(equipped)..""
+		.." cost: "..tostring(res)..""
+		.." slot : "..tostring(slot)..""
+		.."["..tostring(slotName).."]"
+		.." '"..tostring(name).."'"
+		debug_msg(msg)
+	end
+
 	return equipped, res
 end

---[[ local
--- **************************************************************************
--- NAME : GetRepairCostBag()
--- DESC : Assuming an item in a bag, get the repair cost
--- VARS :
--- bag : int : bag to check
--- slot : int : bag slot
--- OUT :
--- int : repair cost or 0
--- **************************************************************************
---]]
+---local Assuming an item in a bag, get the repair cost
+---@param bag number
+---@param slot number
+---@return number
 local function GetRepairCostBag(bag, slot)
 	local res = 0

 	--Blizz changed SetInventoryItem for DragonFlight
-	-- use a proxy for retail (true) versus classic (false)
 	if C_TooltipInfo then
 		local data = C_TooltipInfo.GetBagItem(bag, slot)
 		if data then
@@ -242,28 +221,15 @@ local function GetRepairCostBag(bag, slot)
 		TitanRepairTooltip:ClearLines()
 		local _, repairCost = TitanRepairTooltip:SetBagItem(bag, slot)
 		res = repairCost
---[[
-print("TRepair cost"
-	.." '"..tostring(bag).."'"
-	.." "..tostring(slot)..""
-	.." "..tostring(res)..""
---]]
 		TitanRepairTooltip:Hide()
 	end

 	return res
 end

---[[ local
--- **************************************************************************
--- NAME : Scan(reason, force)
--- DESC : Scan all bags and equipment and set the 'scan in progress'
--- VARS :
--- reason : string : for debug only - why was the scan requested?
--- force : boolean : whether to force a scan such as on player entering world or user request
--- Note: On a successful scan, the plugin button is updated.
--- **************************************************************************
---]]
+---local Scan all bags and equipment and set the 'scan in progress'. On a successful scan, the plugin button is updated.
+---@param reason string For debug only - why was the scan requested?
+---@param force boolean Force a scan if true otherwise use time since last scan
 local function Scan(reason, force)
 --[==[
 local _, _, Color, Ltype, Id, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, reforging, Name = string.find(itemLink, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
@@ -308,8 +274,6 @@ print
 			debug_msg(dmsg)
 		end

-		local itemName, _, itemQuality
-
 		-- Walk thru slots 'backward' to give weapons 'priority' if most damagaged
 		for slotID = TR.scan_start, TR.scan_end, -1 do  -- thru slots
 			local slotName = slots[slotID].name
@@ -328,31 +292,29 @@ print
 				scan_slots = scan_slots
 					.." item: Empty"
 			else
-					_, _, Color, Ltype, Id, Enchant,
-					Gem1, Gem2, Gem3, Gem4,
-					Suffix, Unique, LinkLvl, reforging, Name = string.find(itemLink, parse_item)
+				_, _, Color, Ltype, Id, Enchant,
+				Gem1, Gem2, Gem3, Gem4,
+				Suffix, Unique, LinkLvl, reforging, Name = string.find(itemLink, parse_item)
 				itemName, _, itemQuality = GetItem(Id)

 				scan_slots = scan_slots
 					.." id:"..tostring(Id)..""
 					.." '"..tostring(itemName).."'"

-					if Id == nil or itemName == nil then -- item data should be good
+				if Id == nil or itemName == nil then
 					-- likely entering world, server has not fully sent data to use
+					-- Set a timer for 1 sec rather than waiting for some event
 					if (TR.show_debug or TR.show_debug_scan) then
 						scan_slots = scan_slots
 							..TitanUtils_GetRedText(" scan: in 1 sec")
 							.." on:"..tostring(TR_Timer_active)..""
 						debug_msg(scan_slots)
 					end
---					if TR_Timer_active then
-						-- Let the existing timer run
---					else
-						TR_Timer_active = true
-						TR_Timer = AceTimer:ScheduleTimer(TitanRepair_ScanShell, 1.0)
---					end
+					TR_Timer_active = true
+					TR_Timer = AceTimer:ScheduleTimer(TitanRepair_ScanShell, 1.0)
 					return -- harsh but best...
 				else
+					-- item data should be good
 					local minimum, maximum = GetInventoryItemDurability(slotID)
 					if minimum and maximum then -- Only calc when item has durability
 						local hasItem, repairCost = GetRepairCostEquip(slotName, slotID)
@@ -536,18 +498,14 @@ print
 	end
 end

+---local Called from timer; used when entering world and data may not be ready.
 function TitanRepair_ScanShell()
 	Scan("Timer initiated", true)
 	TR_Timer_active = false
 end

---[[ local
--- **************************************************************************
--- NAME : RepairShow()
--- DESC : Prepare to activate Repair - events, init, etc.
--- VARS : None
--- **************************************************************************
---]]
+---local Activate Repair - events, init, scan, etc.
+---@param self Button
 local function RepairShow(self)
 	if TR.show_debug then
 		debug_msg("RepairShow - starting")
@@ -568,13 +526,8 @@ local function RepairShow(self)
 	end
 end

---[[ local
--- **************************************************************************
--- NAME : RepairHide()
--- DESC : Prepare to deactivate Repair - events, etc.
--- VARS : None
--- **************************************************************************
---]]
+---local Deactivate Repair - events, init, etc.
+---@param self Button
 local function RepairHide(self)
 	if TR.show_debug then
 		debug_msg("RepairHide - shutting down")
@@ -592,19 +545,12 @@ local function RepairHide(self)
 	end
 end

---[[ local
--- **************************************************************************
--- NAME : GetGSC(money)
--- DESC : Scan all bags and equipment and set the 'scan in progress'
--- VARS :
--- money : int : money in copper
--- OUT :
--- int : gold component
--- int : silver component
--- int : copper component
--- boolean : whether value is negative or not
--- **************************************************************************
---]]
+---local Get gold, silver, copper from the given money (in copper)
+---@param money number Money in copper
+---@return integer
+---@return integer
+---@return integer
+---@return boolean
 local function GetGSC(money)
 	local neg = false;
 	if (money == nil) then money = 0; end
@@ -628,6 +574,9 @@ end
 -- gsc : string : formatted and colored of given money
 -- **************************************************************************
 --]]
+---local Get a formated string from the given money (in copper)
+---@param money number Money in copper
+---@return string readable_money
 local function GetTextGSC(money)
 	local GSC_GOLD = "ffd100";
 	local GSC_SILVER = "e6e6e6";
@@ -664,12 +613,7 @@ local function GetTextGSC(money)
 	return gsc;
 end

---[[ local
--- **************************************************************************
--- NAME : TitanRepair_RepairItems()
--- DESC : <research>
--- **************************************************************************
---]]
+---local Repair items per user settings to use Guild or own gold.
 local function TitanRepair_RepairItems()
 --[=[
 Jul 2023 / 10.1.5
@@ -684,6 +628,12 @@ Realized the Disable also changes the button so the DeSat is redundent
 	local cost = GetRepairAllCost();
 	local money = GetMoney();

+	if cost == nil then -- for IDE...
+		cost = 0
+	else
+		-- cost is reasonable
+	end
+
 	-- Use Guild Bank funds
 	if TR.guild_bank and TitanGetVar(TITAN_REPAIR_ID,"UseGuildBank") then
 		local withdrawLimit = GetGuildBankWithdrawMoney();
@@ -742,12 +692,7 @@ Realized the Disable also changes the button so the DeSat is redundent
 	end
 end

---[[ local
--- **************************************************************************
--- NAME : TitanRepair_SellGrayItems()
--- DESC : <research>
--- **************************************************************************
---]]
+---local Rummage through bags, selling any gray items.
 local function TitanRepair_SellGrayItems()
 	if TR.show_debug then
 		debug_msg("Selling gray items")
@@ -797,15 +742,10 @@ local function TitanRepair_SellGrayItems()
 	end
 end

---[[ local
--- **************************************************************************
--- NAME : AutoHighlight (item_frac, valueText)
--- DESC : Color (green / white / red) the given string (durability as % or x / y) based on the given percentage
--- VARS :
--- item_frac : float : the percentage of durability
--- valueText : string : durability in color
--- **************************************************************************
---]]
+---local Color (green / white / red) the given string based on its durability %
+---@param item_frac number
+---@param valueText string
+---@return string
 local function AutoHighlight (item_frac, valueText)
 	-- Basic threshold coloring
 	-- Do not check for <= 0.90 or <= 0.20 because fractional eguality test is not acurate...
@@ -824,12 +764,10 @@ local function AutoHighlight (item_frac, valueText)
 	return valueText;
 end

---[[
--- **************************************************************************
--- NAME : OnEvent(self, event, a1, ...)
--- DESC : This section will grab the events registered to the add on and act on them
--- **************************************************************************
---]]
+---local Handle events registered to plugin
+---@param self Button
+---@param event string
+---@param ... any
 local function OnEvent(self, event, a1, ...)

 	if TR.show_debug then
@@ -949,16 +887,14 @@ local function GetDiscountCost(sum)
 		return costStr, discountlabel
 end

---[[
--- **************************************************************************
--- NAME : GetButtonText(id)
--- DESC : Determine the plugin button text based on last scan values and user preferences
--- VARS : id = plugin id (Repair)
--- OUT :
--- string : plugin label
--- string : plugin text / values
--- **************************************************************************
---]]
+---local Determine the plugin button text based on last scan values and user preferences.
+---@param id string
+---@return string text_label
+---@return string text
+---@return string | nil most_label
+---@return string | nil most
+---@return string | nil gray_header
+---@return string | nil gray_total
 local function GetButtonText(id)
 	local itemNamesToShow = ""
 	local itemPercent = 0
@@ -1049,12 +985,8 @@ local function GetButtonText(id)
 	end
 end

---[[
--- **************************************************************************
--- NAME : GetTooltipText()
--- DESC : Create the Repair tool tip based on last scan and user preferences
--- **************************************************************************
---]]
+---local Create the Repair tool tip based on last scan and user preferences.
+---@return string tooltip_text
 local function GetTooltipText()
 	local out = "";
 	local cost = 0;
@@ -1177,6 +1109,11 @@ local function GetTooltipText()
 					out = out..TitanUtils_GetHighlightText(WITHDRAW.." "..AVAILABLE).."\t" ..UNLIMITED.."\n"
 				else
 					local withdrawLimit = GetGuildBankWithdrawMoney()
+					if withdrawLimit == nil then
+						withdrawLimit = 0
+					else
+						-- limit is known
+					end
 					out = out..TitanUtils_GetHighlightText(WITHDRAW.." "..AVAILABLE).."\t"..GetTextGSC(withdrawLimit).."\n"
 					if (withdrawLimit >= sum) then
 						-- funds available
@@ -1210,12 +1147,7 @@ local function GetTooltipText()
 	return out
 end

---[[
--- **************************************************************************
--- NAME : CreateMenu()
--- DESC : Create the Repair right click menu
--- **************************************************************************
---]]
+---local Create the Repair right click menu
 local function CreateMenu()
 	local info;

@@ -1480,12 +1412,8 @@ local function CreateMenu()
 	TitanPanelRightClickMenu_AddControlVars(TITAN_REPAIR_ID)
 end

---[[
--- **************************************************************************
--- NAME : OnLoad(self)
--- DESC : Registers the plugin upon loading; OnShow to start; OnHide to stop
--- **************************************************************************
---]]
+---local Create the .registry for the plugin.
+---@param self Button
 local function OnLoad(self)
 	local notes = ""
 		.."Provides a configurable durability display. Adds the ability to auto repair items and inventory at vendors.\n"
@@ -1540,12 +1468,7 @@ local function OnLoad(self)
 	};
 end

---[[ local
--- **************************************************************************
--- NAME : Create_Frames()
--- DESC : Create the required Repair plugin frames
--- **************************************************************************
---]]
+---local Create plugin, tooltip, and pop up frames; set frame scripts.
 local function Create_Frames()
 	if _G[TITAN_BUTTON] then
 		return -- if already created
diff --git a/TitanVolume/TitanVolume.lua b/TitanVolume/TitanVolume.lua
index 091c192..ad9ef2a 100644
--- a/TitanVolume/TitanVolume.lua
+++ b/TitanVolume/TitanVolume.lua
@@ -18,17 +18,75 @@ local _G = getfenv(0);
 local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)

 local ALL_SOUND = "Sound_EnableAllSound"
+
+-- The slider controls are nearly identical so set the data for them using the slider frame name
+local sliders = {
+	["TitanPanelMasterVolumeControlSlider"] = {
+		short = "master",
+		cvar = "Sound_MasterVolume",
+		gtext = OPTION_TOOLTIP_MASTER_VOLUME,
+		titan_var = "VolumeMaster",
+		off_x = -160, off_y = -60,
+	},
+	["TitanPanelSoundVolumeControlSlider"] = {
+		short = "sound",
+		cvar = "Sound_SFXVolume",
+		gtext = OPTION_TOOLTIP_FX_VOLUME,
+		titan_var = "VolumeSFX",
+		off_x = -90, off_y = -60,
+	},
+	["TitanPanelMusicVolumeControlSlider"] = {
+		short = "music",
+		cvar = "Sound_MusicVolume",
+		gtext = OPTION_TOOLTIP_MUSIC_VOLUME,
+		titan_var = "VolumeMusic",
+		off_x = -20, off_y = -60,
+	},
+	["TitanPanelAmbienceVolumeControlSlider"] = {
+		short = "ambience",
+		cvar = "Sound_AmbienceVolume",
+		gtext = OPTION_TOOLTIP_AMBIENCE_VOLUME,
+		titan_var = "VolumeAmbience",
+		off_x = 50, off_y = -60,
+	},
+	["TitanPanelDialogVolumeControlSlider"] = {
+		short = "dialog",
+		cvar = "Sound_DialogVolume",
+		gtext = OPTION_TOOLTIP_DIALOG_VOLUME,
+		titan_var = "VolumeDialog",
+		off_x = 130, off_y = -60,
+	},
+}
+--C_CVar.GetCVar("Sound_MusicVolume")
+---local Get requested sound volume from Blizz C var API as a number.
+---@param volume string
+---@return number
+local function GetCVolume(volume)
+	-- Make explicit for clarity and IDE
+	local vol = C_CVar.GetCVar(volume)
+	-- If Blizz ever changes sound label strings, don't error
+	if vol == nil then
+		vol = "0"
+	else
+		-- accept value
+	end
+	return tonumber(vol)
+end
+
+---local Get volume as a % string.
+---@param volume number | string
+---@return string
 local function GetVolumeText(volume)
-	return tostring(floor(100 * volume + 0.5)) .. "%";
+	return tostring(floor(100 * tonumber(volume) + 0.5)) .. "%";
 end

+---local Get from WoW if 'all' sound is muted.
+---@return boolean
 local function IsMuted()
 	local mute = false
 	local setting = ALL_SOUND
-	local value = C_CVar.GetCVar(setting)
-	if value == nil then
-		-- value is invalid - Blizz change??
-	elseif value == "0" then
+	local value = GetCVolume(setting)
+	if value == "0" then
 		mute = true
 	elseif value == "1" then
 		-- not muted
@@ -38,10 +96,11 @@ local function IsMuted()
 	return mute
 end

+---local Set plugin icon as off/low/med/high.
 local function SetVolumeIcon()
 	local plugin = TitanUtils_GetPlugin(TITAN_VOLUME_ID)

-	local masterVolume = tonumber(GetCVar("Sound_MasterVolume"));
+	local masterVolume = GetCVolume("Sound_MasterVolume")
 	if (masterVolume <= 0)
 	or IsMuted()
 	then
@@ -55,6 +114,9 @@ local function SetVolumeIcon()
 	end
 end

+---local Handle events registered to plugin
+---@param self Button
+---@param event string
 local function OnEvent(self, event, a1, ...)
 	if event == "PLAYER_ENTERING_WORLD" and TitanGetVar(TITAN_VOLUME_ID, "OverrideBlizzSettings") then
 		-- Override Blizzard's volume CVar settings
@@ -76,73 +138,86 @@ local function OnEvent(self, event, a1, ...)
 	end
 end

+---local Set plugin icon and update plugin.
 local function OnShow()
 	SetVolumeIcon();
 	TitanPanelButton_UpdateButton(TITAN_VOLUME_ID);
 end

+---local On mouse over, set values for sliders in case of right click.
 local function OnEnter()
-	-- Confirm master volume value
-	TitanPanelMasterVolumeControlSlider:SetValue(1 - GetCVar("Sound_MasterVolume"));
-	TitanPanelAmbienceVolumeControlSlider:SetValue(1 - GetCVar("Sound_AmbienceVolume"));
-	TitanPanelDialogVolumeControlSlider:SetValue(1 - GetCVar("Sound_DialogVolume"));
-	TitanPanelSoundVolumeControlSlider:SetValue(1 - GetCVar("Sound_SFXVolume"));
-	TitanPanelMusicVolumeControlSlider:SetValue(1 - GetCVar("Sound_MusicVolume"));
-	--	TitanPanelMicrophoneVolumeControlSlider:SetValue(1 - GetCVar("OutboundChatVolume"));
-	--	TitanPanelSpeakerVolumeControlSlider:SetValue(1 - GetCVar("InboundChatVolume"));
---	SetVolumeIcon();
+	for idx, slider in pairs (sliders) do
+		_G[idx]:SetValue(1 - GetCVolume(slider.cvar))
+	end
 end

--- 'Master'
-local function MasterSlider_OnEnter(self)
-	--	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_MASTER_VOLUME, GetVolumeText(GetCVar("Sound_MasterVolume")));
-	self.tooltipText = ""
+-- ====== Slider helpers
+---local On mouse over; set tooltip.
+---@param self Slider
+local function Slider_OnEnter(self)
+	local slider = sliders[self:GetName()]
+	local tooltipText = ""
+	tooltipText = TitanOptionSlider_TooltipText(slider.gtext, GetVolumeText(GetCVolume(slider.cvar)));
 	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
-	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
+	GameTooltip:SetText(tooltipText, nil, nil, nil, nil, 1);
 	TitanUtils_StopFrameCounting(self:GetParent());
 end

-local function MasterSlider_OnLeave(self)
-	self.tooltipText = nil;
+---local On mouse leaving; prep hide of tooltip.
+---@param self Slider
+local function Slider_OnLeave(self)
 	GameTooltip:Hide();

-	local masterVolume = tonumber(GetCVar("Sound_MasterVolume"));
-	if (masterVolume <= 0) then
-		C_CVar.SetCVar(ALL_SOUND, "0")
-	else
-		C_CVar.SetCVar(ALL_SOUND, "1")
+	local slider = sliders[self:GetName()]
+	if slider.short == "master" then
+		local masterVolume = tonumber(GetCVolume(slider.cvar));
+		if (masterVolume <= 0) then
+			C_CVar.SetCVar(ALL_SOUND, "0")
+		else
+			C_CVar.SetCVar(ALL_SOUND, "1")
+		end
 	end

 	TitanUtils_StartFrameCounting(self:GetParent(), TITAN_VOLUME_FRAME_SHOW_TIME);
 end

-local function MasterSlider_OnShow(self)
-	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(GetCVar("Sound_MasterVolume")));
+---local On show; get and show current volume and bounds.
+---@param self Slider
+local function Slider_OnShow(self)
+	local slider = sliders[self:GetName()]
+
+	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(GetCVolume(slider.cvar)));
 	_G[self:GetName() .. "High"]:SetText(Titan_Global.literals.low);
 	_G[self:GetName() .. "Low"]:SetText(Titan_Global.literals.high);
 	self:SetMinMaxValues(0, 1);
 	self:SetValueStep(0.01);
 	self:SetObeyStepOnDrag(true) -- since 5.4.2 (Mists of Pandaria)
-	self:SetValue(1 - GetCVar("Sound_MasterVolume"));
+	self:SetValue(1 - GetCVolume(slider.cvar));
 end

-local function MasterSlider_OnValueChanged(self, a1)
+---local On value changed; get and show current volume and bounds.
+---@param self Slider
+---@param a1 number
+local function Slider_OnValueChanged(self, a1)
+	local slider = sliders[self:GetName()]
+
 	local vol = 1 - self:GetValue()
 	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(vol));

-	SetCVar("Sound_MasterVolume", vol);
-	TitanSetVar(TITAN_VOLUME_ID, "VolumeMaster", vol)
+	C_CVar.SetCVar(slider.cvar, vol);
+	TitanSetVar(TITAN_VOLUME_ID, slider.titan_var, vol)

 	SetVolumeIcon();
 	TitanPanelButton_UpdateButton(TITAN_VOLUME_ID);

 	-- Update GameTooltip
-	if (self.tooltipText) then
-		self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_MASTER_VOLUME, GetVolumeText(1 - self:GetValue()));
-		GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	end
+	local tooltipText = TitanOptionSlider_TooltipText(slider.gtext, GetVolumeText(1 - self:GetValue()));
+	GameTooltip:SetText(tooltipText, nil, nil, nil, nil, 1);
 end

+---local Any slider value changed via mouse wheel; update slider only; _OnValueChanged will update WoW and tooltip.
+---@param self Slider
+---@param a1 number
 local function OnMouseWheel(self, a1)
 	local tempval = self:GetValue();

@@ -155,167 +230,8 @@ local function OnMouseWheel(self, a1)
 	end
 end

--- 'Music'
-local function MusicSlider_OnEnter(self)
-	--	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_MUSIC_VOLUME, GetVolumeText(GetCVar("Sound_MusicVolume")));
-	self.tooltipText = ""
-	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
-	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	TitanUtils_StopFrameCounting(self:GetParent());
-end
-
-local function MusicSlider_OnLeave(self)
-	self.tooltipText = nil;
-	GameTooltip:Hide();
-	TitanUtils_StartFrameCounting(self:GetParent(), TITAN_VOLUME_FRAME_SHOW_TIME);
-end
-
-local function MusicSlider_OnShow(self)
-	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(GetCVar("Sound_MusicVolume")));
-	_G[self:GetName() .. "High"]:SetText(Titan_Global.literals.low);
-	_G[self:GetName() .. "Low"]:SetText(Titan_Global.literals.high);
-	self:SetMinMaxValues(0, 1);
-	self:SetValueStep(0.01);
-	self:SetValue(1 - GetCVar("Sound_MusicVolume"));
-end
-
-local function MusicSlider_OnValueChanged(self, a1)
-	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(1 - self:GetValue()));
-
-	SetCVar("Sound_MusicVolume", 1 - self:GetValue());
-	TitanSetVar(TITAN_VOLUME_ID, "VolumeMusic", 1 - self:GetValue())
-
-	-- Update GameTooltip
-	if (self.tooltipText) then
-		self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_MUSIC_VOLUME, GetVolumeText(1 - self:GetValue()));
-		GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	end
-end
-
--- 'Sound Effects'
-local function SoundSlider_OnEnter(self)
-	--	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_FX_VOLUME, GetVolumeText(GetCVar("Sound_SFXVolume")));
-	self.tooltipText = ""
-	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
-	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	TitanUtils_StopFrameCounting(self:GetParent());
-end
-
-local function SoundSlider_OnLeave(self)
-	self.tooltipText = nil;
-	GameTooltip:Hide();
-	TitanUtils_StartFrameCounting(self:GetParent(), TITAN_VOLUME_FRAME_SHOW_TIME);
-end
-
-local function SoundSlider_OnShow(self)
-	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(GetCVar("Sound_SFXVolume")));
-	_G[self:GetName() .. "High"]:SetText(Titan_Global.literals.low);
-	_G[self:GetName() .. "Low"]:SetText(Titan_Global.literals.high);
-	self:SetMinMaxValues(0, 1);
-	self:SetValueStep(0.01);
-	self:SetValue(1 - GetCVar("Sound_SFXVolume"));
-end
-
-local function SoundSlider_OnValueChanged(self, a1)
-	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(1 - self:GetValue()));
-
-	SetCVar("Sound_SFXVolume", 1 - self:GetValue());
-	TitanSetVar(TITAN_VOLUME_ID, "VolumeSFX", 1 - self:GetValue())
-
-	-- Update GameTooltip
-	if (self.tooltipText) then
-		self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_FX_VOLUME, GetVolumeText(1 - self:GetValue()));
-		GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	end
-end
-
--- 'Ambience'
-local function AmbienceSlider_OnEnter(self)
-	--	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_AMBIENCE_VOLUME, GetVolumeText(GetCVar("Sound_AmbienceVolume")));
-	self.tooltipText = ""
-	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
-	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	TitanUtils_StopFrameCounting(self:GetParent());
-end
-
-local function AmbienceSlider_OnLeave(self)
-	self.tooltipText = nil;
-	GameTooltip:Hide();
-	TitanUtils_StartFrameCounting(self:GetParent(), TITAN_VOLUME_FRAME_SHOW_TIME);
-end
-
-local function AmbienceSlider_OnShow(self)
-	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(GetCVar("Sound_AmbienceVolume")));
-	_G[self:GetName() .. "High"]:SetText(Titan_Global.literals.low);
-	_G[self:GetName() .. "Low"]:SetText(Titan_Global.literals.high);
-	self:SetMinMaxValues(0, 1);
-	self:SetValueStep(0.01);
-	self:SetValue(1 - GetCVar("Sound_AmbienceVolume"));
-end
-
-local function AmbienceSlider_OnValueChanged(self, a1)
-	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(1 - self:GetValue()));
-	local tempval = self:GetValue();
-
-	SetCVar("Sound_AmbienceVolume", 1 - self:GetValue());
-	TitanSetVar(TITAN_VOLUME_ID, "VolumeAmbience", 1 - self:GetValue())
-
-	-- Update GameTooltip
-	if (self.tooltipText) then
-		--		self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_VOLUME_CONTROL_TOOLTIP"], GetVolumeText(1 - self:GetValue()));
-		self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_ENABLE_AMBIENCE,
-			GetVolumeText(1 - self:GetValue()));
-		GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	end
-end
-
--- 'Dialog'
-local function DialogSlider_OnEnter(self)
-	--	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_DIALOG_VOLUME, GetVolumeText(GetCVar("Sound_DialogVolume")));
-	self.tooltipText = ""
-	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
-	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	TitanUtils_StopFrameCounting(self:GetParent());
-end
-
-local function DialogSlider_OnLeave(self)
-	self.tooltipText = nil;
-	GameTooltip:Hide();
-	TitanUtils_StartFrameCounting(self:GetParent(), TITAN_VOLUME_FRAME_SHOW_TIME);
-end
-
-local function DialogSlider_OnShow(self)
-	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(GetCVar("Sound_DialogVolume")));
-	_G[self:GetName() .. "High"]:SetText(Titan_Global.literals.low);
-	_G[self:GetName() .. "Low"]:SetText(Titan_Global.literals.high);
-	self:SetMinMaxValues(0, 1);
-	self:SetValueStep(0.01);
-	self:SetValue(1 - GetCVar("Sound_DialogVolume"));
-end
-
-local function DialogSlider_OnValueChanged(self, a1)
-	_G[self:GetName() .. "Text"]:SetText(GetVolumeText(1 - self:GetValue()));
-	local tempval = self:GetValue();
-
-	SetCVar("Sound_DialogVolume", 1 - self:GetValue());
-	TitanSetVar(TITAN_VOLUME_ID, "VolumeDialog", 1 - self:GetValue())
-
-	-- Update GameTooltip
-	if (self.tooltipText) then
-		--		self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_VOLUME_CONTROL_TOOLTIP"], GetVolumeText(1 - self:GetValue()));
-		self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_DIALOG_VOLUME, GetVolumeText(1 - self:GetValue()));
-		GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	end
-end
-
-
---[[ WoW 9.5
-Blizzard decided to remove direct Backdrop API in 9.0 (Shadowlands)
-so inherit the template (XML)
-and set the values in the code (Lua)
-
-9.5 The tooltip template was removed from the GameTooltip.
---]]
+---local Inititalize custom left click menu
+---@param self Frame
 local function ControlFrame_OnLoad(self)
 	_G[self:GetName() .. "Title"]:SetText(L["TITAN_VOLUME_CONTROL_TITLE"]);         -- VOLUME
 	_G[self:GetName() .. "MasterTitle"]:SetText(L["TITAN_VOLUME_MASTER_CONTROL_TITLE"]); --MASTER_VOLUME
@@ -328,6 +244,8 @@ local function ControlFrame_OnLoad(self)
 	TitanPanelRightClickMenu_SetCustomBackdrop(self)
 end

+---local Generate tooltip text
+---@return string
 local function GetTooltipText()
 	local mute = Titan_Global.literals.muted

@@ -338,13 +256,13 @@ local function GetTooltipText()
 	end
 	local text = ""

-	local volumeMasterText = GetVolumeText(GetCVar("Sound_MasterVolume"));
-	local volumeSoundText = GetVolumeText(GetCVar("Sound_SFXVolume"));
-	local volumeMusicText = GetVolumeText(GetCVar("Sound_MusicVolume"));
-	local volumeAmbienceText = GetVolumeText(GetCVar("Sound_AmbienceVolume"));
-	local volumeDialogText = GetVolumeText(GetCVar("Sound_DialogVolume"));
-	--	local volumeMicrophoneText = GetVolumeText(GetCVar("OutboundChatVolume"));
-	--	local volumeSpeakerText = GetVolumeText(GetCVar("InboundChatVolume"));
+	local volumeMasterText = GetVolumeText(GetCVolume("Sound_MasterVolume"));
+	local volumeSoundText = GetVolumeText(GetCVolume("Sound_SFXVolume"));
+	local volumeMusicText = GetVolumeText(GetCVolume("Sound_MusicVolume"));
+	local volumeAmbienceText = GetVolumeText(GetCVolume("Sound_AmbienceVolume"));
+	local volumeDialogText = GetVolumeText(GetCVolume("Sound_DialogVolume"));
+	--	local volumeMicrophoneText = GetVolumeText(GetCVolume("OutboundChatVolume"));
+	--	local volumeSpeakerText = GetVolumeText(GetCVolume("InboundChatVolume"));

 	text = ""..
 	mute ..
@@ -362,7 +280,8 @@ local function GetTooltipText()
 	return text
 end

-function CreateMenu()
+---local Generate the right click menu
+local function CreateMenu()
 	TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_VOLUME_ID].menuText);

 	local info = {};
@@ -384,6 +303,9 @@ function CreateMenu()
 	TitanPanelRightClickMenu_AddControlVars(TITAN_VOLUME_ID)
 end

+---local On double click toggle the all sound mute; will flash the slider frame...
+---@param self Button
+---@param button string
 local function OnDoubleClick(self, button)
 	if button == "LeftButton" then
 		-- Toggle mute value
@@ -400,6 +322,8 @@ local function OnDoubleClick(self, button)
 	end
 end

+---local Create plugin .registry and and register for first events
+---@param self Button
 local function OnLoad(self)
 	local notes = ""
 	.. "Adds a volume control icon on your Titan Bar.\n"
@@ -438,7 +362,7 @@ local function OnLoad(self)
 	self:RegisterEvent("PLAYER_ENTERING_WORLD");
 end

--- ====== Create needed frames
+---local Create needed frames
 local function Create_Frames()
 	if _G[TITAN_VOLUME_BUTTON] then
 		return -- if already created
@@ -465,8 +389,6 @@ local function Create_Frames()
 	end)
 	window:SetScript("OnEvent", function(self, event, ...)
 		OnEvent(self, event, ...)
-		-- ... not allowed here so grab the potential args that may be needed
-		--		OnEvent(self, event, arg1, arg2, arg3, arg4)
 	end)


@@ -513,104 +435,28 @@ local function Create_Frames()
 	str = config:CreateFontString(cname .. "DialogTitle", "ARTWORK", style)
 	str:SetPoint("TOP", config, 130, -30)

-	-- Config slider sections
-	local slider = nil
+	-- ====== Config slider sections

-	-- Master
 	local inherit = "TitanOptionsSliderTemplate"
-	local master = CreateFrame("Slider", "TitanPanelMasterVolumeControlSlider", config, inherit)
-	master:SetPoint("TOP", config, -160, -60)
-	master:SetScript("OnShow", function(self)
-		MasterSlider_OnShow(self)
-	end)
-	master:SetScript("OnValueChanged", function(self, value)
-		MasterSlider_OnValueChanged(self, value)
-	end)
-	master:SetScript("OnMouseWheel", function(self, delta)
-		OnMouseWheel(self, delta)
-	end)
-	master:SetScript("OnEnter", function(self)
-		MasterSlider_OnEnter(self)
-	end)
-	master:SetScript("OnLeave", function(self)
-		MasterSlider_OnLeave(self)
-	end)
-
-	-- Sound
-	local sound = CreateFrame("Slider", "TitanPanelSoundVolumeControlSlider", config, inherit)
-	sound:SetPoint("TOP", config, -90, -60)
-	sound:SetScript("OnShow", function(self)
-		SoundSlider_OnShow(self)
-	end)
-	sound:SetScript("OnValueChanged", function(self, value)
-		SoundSlider_OnValueChanged(self, value)
-	end)
-	sound:SetScript("OnMouseWheel", function(self, delta)
-		OnMouseWheel(self, delta)
-	end)
-	sound:SetScript("OnEnter", function(self)
-		SoundSlider_OnEnter(self)
-	end)
-	sound:SetScript("OnLeave", function(self)
-		SoundSlider_OnLeave(self)
-	end)
-
-	-- Music
-	local music = CreateFrame("Slider", "TitanPanelMusicVolumeControlSlider", config, inherit)
-	music:SetPoint("TOP", config, -20, -60)
-	music:SetScript("OnShow", function(self)
-		MusicSlider_OnShow(self)
-	end)
-	music:SetScript("OnValueChanged", function(self, value)
-		MusicSlider_OnValueChanged(self, value)
-	end)
-	music:SetScript("OnMouseWheel", function(self, delta)
-		OnMouseWheel(self, delta)
-	end)
-	music:SetScript("OnEnter", function(self)
-		MusicSlider_OnEnter(self)
-	end)
-	music:SetScript("OnLeave", function(self)
-		MusicSlider_OnLeave(self)
-	end)
-
-	-- Ambience
-	local ambience = CreateFrame("Slider", "TitanPanelAmbienceVolumeControlSlider", config, inherit)
-	ambience:SetPoint("TOP", config, 50, -60)
-	ambience:SetScript("OnShow", function(self)
-		AmbienceSlider_OnShow(self)
-	end)
-	ambience:SetScript("OnValueChanged", function(self, value)
-		AmbienceSlider_OnValueChanged(self, value)
-	end)
-	ambience:SetScript("OnMouseWheel", function(self, delta)
-		OnMouseWheel(self, delta)
-	end)
-	ambience:SetScript("OnEnter", function(self)
-		AmbienceSlider_OnEnter(self)
-	end)
-	ambience:SetScript("OnLeave", function(self)
-		AmbienceSlider_OnLeave(self)
-	end)
-
-	-- Dialog
-	local dialog = CreateFrame("Slider", "TitanPanelDialogVolumeControlSlider", config, inherit)
-	dialog:SetPoint("TOP", config, 130, -60)
-	dialog:SetScript("OnShow", function(self)
-		DialogSlider_OnShow(self)
-	end)
-	dialog:SetScript("OnValueChanged", function(self, value)
-		DialogSlider_OnValueChanged(self, value)
-	end)
-	dialog:SetScript("OnMouseWheel", function(self, delta)
-		OnMouseWheel(self, delta)
-	end)
-	dialog:SetScript("OnEnter", function(self)
-		DialogSlider_OnEnter(self)
-	end)
-	dialog:SetScript("OnLeave", function(self)
-		DialogSlider_OnLeave(self)
-	end)
+	for idx, slider in pairs (sliders) do
+		local s = CreateFrame("Slider", idx, config, inherit)
+		s:SetPoint("TOP", config, slider.off_x, slider.off_y)
+		s:SetScript("OnShow", function(self)
+			Slider_OnShow(self)
+		end)
+		s:SetScript("OnValueChanged", function(self, value)
+			Slider_OnValueChanged(self, value)
+		end)
+		s:SetScript("OnMouseWheel", function(self, delta)
+			OnMouseWheel(self, delta)
+		end)
+		s:SetScript("OnEnter", function(self)
+			Slider_OnEnter(self)
+		end)
+		s:SetScript("OnLeave", function(self)
+			Slider_OnLeave(self)
+		end)
+	end

 	-- Now that the parts exist, initialize
 	ControlFrame_OnLoad(config)
diff --git a/TitanXP/TitanXP.lua b/TitanXP/TitanXP.lua
index 3fca72c..8784808 100644
--- a/TitanXP/TitanXP.lua
+++ b/TitanXP/TitanXP.lua
@@ -12,12 +12,11 @@
 local TITAN_XP_ID = "XP";
 local TITAN_XP_BUTTON = "TitanPanel" .. TITAN_XP_ID .. "Button"
 local _G = getfenv(0);
-local TITAN_XP_FREQUENCY = 1;
-local updateTable = { TITAN_XP_ID, TITAN_PANEL_UPDATE_ALL };
+--local TITAN_XP_FREQUENCY = 1;
+--local updateTable = { TITAN_XP_ID, TITAN_PANEL_UPDATE_ALL };

 -- ******************************** Variables *******************************

-local lastMobXP, lastXP, XPGain = 0, 0, 0
 local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)

 local AceTimer = LibStub("AceTimer-3.0")
@@ -33,8 +32,20 @@ local trace_update = false

 --****** overload the 'time played' text to Chat - if XP requested the API call
 local requesting
-local xp_frame = {}

+-- collect the various XP variables in one place
+local txp = {
+	frame = {},
+	lastMobXP = 0,
+	XPGain = 0,
+	initXP = 0,
+	accumXP = 0,
+	sessionXP = 0,
+	startSessionTime = 0,
+	totalTime = 0,
+	levelTime = 0,
+	sessionTime = 0,
+}
 -- Save orignal output to Chat
 local orig_ChatFrame_DisplayTimePlayed = ChatFrame_DisplayTimePlayed
 -- Override the output to Chat
@@ -50,12 +61,8 @@ end
 --****** overload

 -- ******************************** Functions *******************************
---[[
--- **************************************************************************
--- NAME : SetIcon()
--- DESC : Define icon based on faction
--- **************************************************************************
---]]
+
+---local Set icon based on faction
 local function SetIcon()
 	local icon = TitanPanelXPButtonIcon;
 	local factionGroup, factionName = UnitFactionGroup("player");
@@ -72,38 +79,34 @@ local function SetIcon()
 	end
 end

---[[
-Add commas or period in the value given as needed
---]]
+---local Add commas or period in the value given per user options
+---@param amount number
+---@return string
 local function comma_value(amount)
-	local formatted = amount
-	local k
-	local sep = (TitanGetVar(TITAN_XP_ID, "UseSeperatorComma") and "UseComma" or "UsePeriod")
-	while true do
-		if sep == "UseComma" then formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') end
-		if sep == "UsePeriod" then formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1.%2') end
-		if (k == 0) then
-			break
-		end
-	end
+	local formatted = ""
+	local sep = (TitanGetVar(TITAN_XP_ID, "UseSeperatorComma") and "," or ".")
+	local i, j, minus, int, fraction = tostring(amount):find('([-]?)(%d+)([.]?%d*)')
+
+	-- reverse the int-string and append a comma to all blocks of 3 digits
+	int = int:reverse():gsub("(%d%d%d)", "%1"..sep)
+
+	-- reverse the int-string back remove an optional comma and put the
+	-- optional minus and fractional part back
+	formatted = minus .. int:reverse():gsub("^"..sep, "") .. fraction
 	return formatted
 end

---[[
--- **************************************************************************
--- NAME : ResetSession()
--- DESC : Reset session and accumulated variables
--- **************************************************************************
---]]
+---local Reset session and accumulated variables
+---@param self Button
 local function ResetSession(self)
-	self.initXP = UnitXP("player")
-	self.accumXP = 0
-	self.sessionXP = 0
-	self.startSessionTime = time() -- clock time
-	lastXP = self.initXP;
+	txp.initXP = UnitXP("player")
+	txp.accumXP = 0
+	txp.sessionXP = 0
+	txp.startSessionTime = time() -- clock time
+	txp.lastXP = txp.initXP;
 end

--- Wrapper for menu to use
+---local Wrapper for menu to use
 local function ResetThisSession()
 	ResetSession(_G[TITAN_XP_BUTTON])
 end
@@ -114,11 +117,12 @@ The timer, started OnShow, will update session time here
 The prior scheme used OnUpdate which is related to FPS.
 XP does not need that level of precision.
 --]]
-local function XPTimeUpdate(plugin)
+---local Reset session and accumulated variables; used by timer
+local function XPTimeUpdate()
 	local elapsed = GetTime() - XPTimer.last
 	XPTimer.last = GetTime()
-	plugin.totalTime = plugin.totalTime + elapsed
-	plugin.levelTime = plugin.levelTime + elapsed
+	txp.totalTime = txp.totalTime + elapsed
+	txp.levelTime = txp.levelTime + elapsed

 	TitanPanelButton_UpdateButton(TITAN_XP_ID)

@@ -129,36 +133,27 @@ local function XPTimeUpdate(plugin)
 	end
 end

---[[
--- **************************************************************************
--- NAME : RefreshPlayed()
--- DESC : Get total time played
+
+---local Get total time played
 -- Do not send RequestTimePlayed output to Chat if XP requested the info.
--- This is done by overriding the routine RequestTimePlayed() uses
--- ChatFrame_DisplayTimePlayed.
--- **************************************************************************
---]]
+-- Override ChatFrame_DisplayTimePlayed used by RequestTimePlayed().
 local function RefreshPlayed()
-	xp_frame:RequestTimePlayed()
+	txp.frame:RequestTimePlayed()
 end

---[[
--- **************************************************************************
--- NAME : OnShow()
--- DESC : Display the icon in the bar
--- **************************************************************************
---]]
+---local Display the plugin on selected Titan bar; register events; start timer; and init vars
+---@param self Button
 local function OnShow(self)
 	local txt = ""

-	if self.sessionTime then
+	if txp.sessionTime then
 		-- No action
 	else
 		-- initial login / PEW
-		self.sessionTime = time();
+		txp.sessionTime = time();
 		txt = txt .. "Sess reset"
 	end
-	if self.initXP then
+	if txp.initXP then
 		-- No action
 	else -- initial login / PEW
 		ResetSession(self)
@@ -177,7 +172,7 @@ local function OnShow(self)
 	if XPTimer.running then
 		-- Do not create a new one
 	else
-		XPTimer.timer = AceTimer:ScheduleRepeatingTimer(XPTimeUpdate, XPTimer.delay, self)
+		XPTimer.timer = AceTimer:ScheduleRepeatingTimer(XPTimeUpdate, XPTimer.delay)
 		XPTimer.running = true
 		XPTimer.last = GetTime() -- No need for millisecond precision
 	end
@@ -189,6 +184,8 @@ local function OnShow(self)
 	end
 end

+---local Hide the plugin; unregister events; stop timer; and init vars
+---@param self Button
 local function OnHide(self)
 	self:UnregisterEvent("TIME_PLAYED_MSG");
 	self:UnregisterEvent("PLAYER_XP_UPDATE");
@@ -200,13 +197,10 @@ local function OnHide(self)
 	XPTimer.timer = nil
 end

---[[
--- **************************************************************************
--- NAME : OnEvent(self, event, a1, a2, ...)
--- DESC : Parse events registered to addon and act on them.
--- VARS : https://warcraft.wiki.gg/wiki/UIHANDLER_OnEvent
--- **************************************************************************
---]]
+---local Handle events registered to plugin
+---@param self Button
+---@param event string
+---@param ... any
 local function OnEvent(self, event, a1, a2, ...)
 	local txt = ""
 	if trace then
@@ -224,44 +218,44 @@ local function OnEvent(self, event, a1, a2, ...)
 		end
 	elseif (event == "TIME_PLAYED_MSG") then
 		-- Remember play time
-		self.totalTime = a1;
-		self.levelTime = a2;
+		txp.totalTime = a1;
+		txp.levelTime = a2;

 		TitanPanelButton_UpdateButton(TITAN_XP_ID)
 	elseif (event == "PLAYER_XP_UPDATE") then
-		if self.initXP then
+		if txp.initXP then
 			-- has been initialized
 		else
 			ResetSession(self)
 		end

-		XPGain = UnitXP("player") - lastXP;
-		lastXP = UnitXP("player");
-		if XPGain < 0 then
-			XPGain = 0
+		txp.XPGain = UnitXP("player") - txp.lastXP;
+		txp.lastXP = UnitXP("player");
+		if txp.XPGain < 0 then
+			txp.XPGain = 0
 		else
 			-- Assume it is valid
 		end
-		self.sessionXP = UnitXP("player") - self.initXP + self.accumXP;
+		txp.sessionXP = UnitXP("player") - txp.initXP + txp.accumXP;
 		TitanPanelButton_UpdateButton(TITAN_XP_ID)
 		if trace then
 			txt = "XP Ev "
 				.. " unit " .. tostring(format("%0.1f", UnitXP("player"))) .. ""
-				.. " init " .. tostring(format("%0.1f", self.initXP)) .. ""
-				.. " acc " .. tostring(format("%0.1f", self.accumXP)) .. ""
+				.. " init " .. tostring(format("%0.1f", txp.initXP)) .. ""
+				.. " acc " .. tostring(format("%0.1f", txp.accumXP)) .. ""
 			TitanPluginDebug(TITAN_XP_ID, txt)
 		end
 	elseif (event == "PLAYER_LEVEL_UP") then
-		self.levelTime = 0;
-		self.accumXP = self.accumXP + UnitXPMax("player") - self.initXP;
-		self.initXP = 0;
+		txp.levelTime = 0;
+		txp.accumXP = txp.accumXP + UnitXPMax("player") - txp.initXP;
+		txp.initXP = 0;
 		TitanPanelButton_UpdateButton(TITAN_XP_ID)
 	elseif (event == "CHAT_MSG_COMBAT_XP_GAIN") then
 		local _, _, _, killXP = string.find(a1, "^" .. L["TITAN_XP_GAIN_PATTERN"])
 		if killXP then
-			lastMobXP = tonumber(killXP)
-			if lastMobXP < 0 then -- sanity check
-				lastMobXP = 0
+			txp.lastMobXP = tonumber(killXP)
+			if txp.lastMobXP < 0 then -- sanity check
+				txp.lastMobXP = 0
 			else
 				-- Assume valid
 			end
@@ -270,33 +264,7 @@ local function OnEvent(self, event, a1, a2, ...)
 	end
 end

---[[
--- **************************************************************************
--- NAME : OnUpdate(elapsed)
--- DESC : Update button data
--- VARS : elapsed = <research>
--- **************************************************************************
---]]
---[[
-local function OnUpdate(self, elapsed)
-	TITAN_XP_FREQUENCY = TITAN_XP_FREQUENCY - elapsed;
-	if (TITAN_XP_FREQUENCY <= 0) then
-		TITAN_XP_FREQUENCY = 1;
-		TitanPanelPluginHandle_OnUpdate(updateTable)
-	end
-	if (self.totalTime) then
-		self.totalTime = self.totalTime + elapsed;
-		self.levelTime = self.levelTime + elapsed;
-	end
-end
---]]
-
---[[
--- **************************************************************************
--- NAME : ShowXPPerHourLevel()
--- DESC : Display per hour to level data in bar if set
--- **************************************************************************
---]]
+---local Display XP / hour to level data.
 local function ShowXPPerHourLevel()
 	TitanSetVar(TITAN_XP_ID, "DisplayType", "ShowXPPerHourLevel");
 	TitanPanelButton_UpdateButton(TITAN_XP_ID);
@@ -306,19 +274,20 @@ local function ShowXPPerHourLevel()
 	TitanSetVar(TITAN_XP_ID, "ShowSimpleNumOfGains", false);
 end

---[[
--- **************************************************************************
--- NAME : GetButtonText(id)
--- DESC : Calculate time based logic for button text
--- VARS : id = button ID
--- NOTE : Because the panel gets loaded before XP we need to check whether
---        the variables have been initialized and take action if they haven't
--- **************************************************************************
---]]
+---local Determine the plugin button text based on user preferences.
+---@param id string
+---@return string text_label
+---@return string text
+---@return string | nil labelrested
+---@return string | nil rest
+---@return string | nil labeltolevel
+---@return string | nil toLevelXPText
+---@return string | nil labelnumofgains
+---@return string | nil numofgains
 local function GetButtonText(id)
 	local txt = ""
 	local button, id = TitanUtils_GetButton(id) -- sanity check, also get plugin frame
-	if button and (TitanPanelXPButton.startSessionTime == nil) then
+	if button and (txp.startSessionTime == nil) then
 		if trace then
 			txt = "XP "
 				.. " " .. tostring("start not set - too early") .. ""
@@ -329,25 +298,25 @@ local function GetButtonText(id)
 		local totalXP = UnitXPMax("player");
 		local currentXP = UnitXP("player");
 		local toLevelXP = totalXP - currentXP;
-		local sessionXP = button and button.sessionXP;
+		local sessionXP = button and txp.sessionXP;
 		local xpPerHour, xpPerHourText, timeToLevel, timeToLevelText;
-		local sessionTime = time() - button.startSessionTime;
-		local levelTime = button.levelTime;
+		local sessionTime = time() - txp.startSessionTime;
+		local levelTime = txp.levelTime;
 		local numofkills, numofgains;
-		if lastMobXP ~= 0 then
-			numofkills = math.ceil(toLevelXP / lastMobXP)
+		if txp.lastMobXP ~= 0 then
+			numofkills = math.ceil(toLevelXP / txp.lastMobXP)
 		else
-			numofkills = _G["UNKNOWN"]
+			numofkills = 0 --_G["UNKNOWN"]
 		end
-		if XPGain ~= 0 then
-			numofgains = math.ceil(toLevelXP / XPGain)
+		if txp.XPGain ~= 0 then
+			numofgains = math.ceil(toLevelXP / txp.XPGain)
 		else
-			numofgains = _G["UNKNOWN"]
+			numofgains = 0 --_G["UNKNOWN"]
 		end
 		if trace_update then
 			txt = "XP / Hr"
 				.. " sxp" .. tostring(format("%0.1f", sessionXP)) .. ""
-				.. " st" .. tostring(format("%0.1f", button.startSessionTime)) .. ""
+				.. " st" .. tostring(format("%0.1f", txp.startSessionTime)) .. ""
 			TitanPluginDebug(TITAN_XP_ID, txt)
 		end

@@ -376,7 +345,6 @@ local function GetButtonText(id)
 					L["TITAN_XP_BUTTON_LABEL_TOLEVEL_TIME_LEVEL"], TitanUtils_GetHighlightText(timeToLevelText);
 			elseif (TitanGetVar(TITAN_XP_ID, "DisplayType") == "ShowXPPerHourLevel") then
 				xpPerHour = currentXP / levelTime * 3600;
-				--			timeToLevel = TitanUtils_Ternary((currentXP == 0), -1, toLevelXP / currentXP * levelTime);
 				timeToLevel = (currentXP == 0) and -1 or toLevelXP / currentXP * levelTime;

 				xpPerHourText = comma_value(math.floor(xpPerHour + 0.5));
@@ -434,27 +402,23 @@ local function GetButtonText(id)
 			if trace_update then
 				TitanPluginDebug(TITAN_XP_ID, "pending")
 			end
-			return "(" .. L["TITAN_XP_UPDATE_PENDING"] .. ")";
+			return "", "(" .. L["TITAN_XP_UPDATE_PENDING"] .. ")"
 		end
 	else
 		-- Invalid button - frame not created?
 	end
+	return "", ""
 end

---[[
--- **************************************************************************
--- NAME : GetTooltipText()
--- DESC : Display tooltip text
--- **************************************************************************
---]]
+---local Generate tooltip text
+---@return string
 local function GetTooltipText()
 	local res = ""
 	local button, id = TitanUtils_GetButton(TITAN_XP_ID) -- sanity check, also get plugin frame
-
 	if button then
-		local totalTime = button.totalTime;
-		local sessionTime = time() - button.startSessionTime;
-		local levelTime = button.levelTime;
+		local totalTime = txp.totalTime;
+		local sessionTime = time() - txp.startSessionTime;
+		local levelTime = txp.levelTime;
 		-- failsafe to ensure that an error wont be returned
 		if levelTime then
 			local totalXP = UnitXPMax("player");
@@ -463,25 +427,27 @@ local function GetTooltipText()
 			local currentXPPercent = currentXP / totalXP * 100;
 			local toLevelXPPercent = toLevelXP / totalXP * 100;
 			local xpPerHourThisLevel = currentXP / levelTime * 3600;
-			local xpPerHourThisSession = button.sessionXP / sessionTime * 3600;
+			local xpPerHourThisSession = txp.sessionXP / sessionTime * 3600;
 			local estTimeToLevelThisLevel = TitanUtils_Ternary((currentXP == 0), -1,
 				toLevelXP / (max(currentXP, 1)) * levelTime);
 			local estTimeToLevelThisSession = 0;
-			if button.sessionXP > 0 then
-				estTimeToLevelThisSession = TitanUtils_Ternary((button.sessionXP == 0), -1,
-					toLevelXP / button.sessionXP * sessionTime);
+
+			if txp.sessionXP > 0 then
+				estTimeToLevelThisSession = TitanUtils_Ternary((txp.sessionXP == 0), -1,
+					toLevelXP / txp.sessionXP * sessionTime);
 			end
 			local numofkills, numofgains;
-			if lastMobXP ~= 0 then
-				numofkills = math.ceil(toLevelXP / lastMobXP)
+			if txp.lastMobXP ~= 0 then
+				numofkills = math.ceil(toLevelXP / txp.lastMobXP)
 			else
-				numofkills = _G["UNKNOWN"]
+				numofkills = 0 --_G["UNKNOWN"]
 			end
-			if XPGain ~= 0 then
-				numofgains = math.ceil(toLevelXP / XPGain)
+			if txp.XPGain ~= 0 then
+				numofgains = math.ceil(toLevelXP / txp.XPGain)
 			else
-				numofgains = _G["UNKNOWN"]
+				numofgains = 0 --_G["UNKNOWN"]
 			end
+
 			res = "" ..
 				L["TITAN_XP_TOOLTIP_TOTAL_TIME"] ..
 				"\t" .. TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(totalTime)) .. "\n" ..
@@ -503,10 +469,10 @@ local function GetTooltipText()
 				TitanUtils_GetHighlightText(comma_value(toLevelXP) .. " " ..
 					format(L["TITAN_XP_PERCENT_FORMAT"], toLevelXPPercent)) .. "\n" ..
 				L["TITAN_XP_TOOLTIP_SESSION_XP"] ..
-				"\t" .. TitanUtils_GetHighlightText(comma_value(button.sessionXP)) .. "\n" ..
-				format(L["TITAN_XP_KILLS_LABEL"], comma_value(lastMobXP)) ..
+				"\t" .. TitanUtils_GetHighlightText(comma_value(txp.sessionXP)) .. "\n" ..
+				format(L["TITAN_XP_KILLS_LABEL"], comma_value(txp.lastMobXP)) ..
 				"\t" .. TitanUtils_GetHighlightText(comma_value(numofkills)) .. "\n" ..
-				format(L["TITAN_XP_XPGAINS_LABEL"], comma_value(XPGain)) ..
+				format(L["TITAN_XP_XPGAINS_LABEL"], comma_value(txp.XPGain)) ..
 				"\t" .. TitanUtils_GetHighlightText(comma_value(numofgains)) .. "\n" ..
 				"\n" ..
 				L["TITAN_XP_TOOLTIP_XPHR_LEVEL"] ..
@@ -526,9 +492,12 @@ local function GetTooltipText()
 	else
 		-- No button - not created?
 	end
+
 	return res
 end

+---local Place commas or periods in the number per user options.
+---@param chosen string
 local function Seperator(chosen)
 	if chosen == "UseSeperatorComma" then
 		TitanSetVar(TITAN_XP_ID, "UseSeperatorComma", true);
@@ -541,12 +510,7 @@ local function Seperator(chosen)
 	TitanPanelButton_UpdateButton(TITAN_XP_ID);
 end

---[[
--- **************************************************************************
--- NAME : ShowXPPerHourSession()
--- DESC : Display per hour in session data in bar if set
--- **************************************************************************
---]]
+---local Display XP per hour this session.
 local function ShowXPPerHourSession()
 	TitanSetVar(TITAN_XP_ID, "DisplayType", "ShowXPPerHourSession");
 	TitanPanelButton_UpdateButton(TITAN_XP_ID);
@@ -556,12 +520,7 @@ local function ShowXPPerHourSession()
 	TitanSetVar(TITAN_XP_ID, "ShowSimpleNumOfGains", false);
 end

---[[
--- **************************************************************************
--- NAME : ShowSessionTime()
--- DESC : Display session time in bar if set
--- **************************************************************************
---]]
+---local Display session time.
 local function ShowSessionTime()
 	TitanSetVar(TITAN_XP_ID, "DisplayType", "ShowSessionTime");
 	TitanPanelButton_UpdateButton(TITAN_XP_ID);
@@ -571,23 +530,13 @@ local function ShowSessionTime()
 	TitanSetVar(TITAN_XP_ID, "ShowSimpleNumOfGains", false);
 end

---[[
--- **************************************************************************
--- NAME : ShowXPSimple()
--- DESC : Display simple XP data (% level, rest, xp to level) in bar if set
--- **************************************************************************
---]]
+---local Display simple XP data (% level, rest, xp to level).
 local function ShowXPSimple()
 	TitanSetVar(TITAN_XP_ID, "DisplayType", "ShowXPSimple");
 	TitanPanelButton_UpdateButton(TITAN_XP_ID);
 end

---[[
--- **************************************************************************
--- NAME : TitanPanelRightClickMenu_PrepareXPMenu()
--- DESC : Display rightclick menu options
--- **************************************************************************
---]]
+---local Generate right click menu.
 local function CreateMenu()
 	local info = {};
 	if TitanPanelRightClickMenu_GetDropdownLevel() == 2 then
@@ -678,12 +627,8 @@ local function CreateMenu()
 	TitanPanelRightClickMenu_AddControlVars(TITAN_XP_ID)
 end

---[[
--- **************************************************************************
--- NAME : OnLoad()
--- DESC : Registers the plugin upon it loading
--- **************************************************************************
---]]
+---local Create plugin .registry and and init some variables and register for first events
+---@param self Button
 local function OnLoad(self)
 	local notes = ""
 		.. "Adds information to Titan Panel about XP earned and time to level.\n"
@@ -721,7 +666,7 @@ local function OnLoad(self)
 	self:RegisterEvent("PLAYER_ENTERING_WORLD");
 end

--- ====== Create needed frames
+---local Create needed frames
 local function Create_Frames()
 	if _G[TITAN_XP_BUTTON] then
 		-- if already created
@@ -732,7 +677,7 @@ local function Create_Frames()

 		-- Titan plugin button
 		local window = CreateFrame("Button", TITAN_XP_BUTTON, f, "TitanPanelComboTemplate")
-		xp_frame = window
+		txp.frame = window
 		window:SetFrameStrata("FULLSCREEN")
 		-- Using SetScript("OnLoad",   does not work
 		OnLoad(window);