Version 1.7.0 (06-05-2018)

Jarth [05-06-18 - 08:25]
Version 1.7.0 (06-05-2018)
Filename
Changelog
Libs/LibAddonMenu-2.0.txt
Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.txt
Libs/LibAddonMenu-2.0/LibStub.lua
Libs/LibAddonMenu-2.0/exampleoptions.lua
Libs/LibJarthSharedBase/LibJarthSharedBase.lua
Libs/LibJarthSharedBase/LibJarthSharedBase.txt
Libs/LibJarthSharedBase/LibJarthSharedBase_Buttons.lua
Libs/LibJarthSharedBase/LibJarthSharedBase_Fragments.lua
Libs/LibJarthSharedBase/LibJarthSharedBase_Hotkeys.lua
Libs/LibJarthSharedBase/LibJarthSharedBase_Move.lua
Libs/exampleoptions.lua
MementoBar.lua
MementoBar.txt
MementoBar_Buttons.lua
MementoBar_Constants.lua
MementoBar_Fragments.lua
MementoBar_Hotkeys.lua
MementoBar_Menu.lua
MementoBar_Move.lua
diff --git a/Changelog b/Changelog
index de1045d..0e89421 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,11 @@
 -------------------------------------------------------------------------------
 Memento bar
 -------------------------------------------------------------------------------
+Version 1.7.0 (06-05-2018)
+- Mainstreamed code base in MementoBar and SummonAssistant.
+- Split shared code into seperate library: "LibJarthSharedBase".
+-- Should make it easier to maintain, and might reduce memory usage.
+
 Version 1.6.2 (18-03-2018)
 - Updated visibility fragments to support:
 -- hud
diff --git a/Libs/LibAddonMenu-2.0.txt b/Libs/LibAddonMenu-2.0.txt
deleted file mode 100644
index b2a7a42..0000000
--- a/Libs/LibAddonMenu-2.0.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-## APIVersion: 100020 100021
-## Title: LibAddonMenu-2.0
-## Version: 2.0 r25
-## AddOnVersion: 25
-## Author: Seerah, sirinsidiator, et al.
-## Contributors: votan, merlight, Garkin, Randactyl, KuroiLight, silvereyes333, Baertram, kyoma
-## Description: A library to aid in the creation of option panels.
-##
-## This Add-on is not created by, affiliated with or sponsored by ZeniMax Media Inc. or its affiliates.
-## The Elder Scrolls® and related logos are registered trademarks or trademarks of ZeniMax Media Inc. in the United States and/or other countries.
-## All rights reserved
-##
-## You can read the full terms at https://account.elderscrollsonline.com/add-on-terms
-
-LibStub\LibStub.lua
-
-LibAddonMenu-2.0\LibAddonMenu-2.0.lua
-
-LibAddonMenu-2.0\controls\panel.lua
-LibAddonMenu-2.0\controls\submenu.lua
-LibAddonMenu-2.0\controls\button.lua
-LibAddonMenu-2.0\controls\checkbox.lua
-LibAddonMenu-2.0\controls\colorpicker.lua
-LibAddonMenu-2.0\controls\custom.lua
-LibAddonMenu-2.0\controls\description.lua
-LibAddonMenu-2.0\controls\dropdown.lua
-LibAddonMenu-2.0\controls\editbox.lua
-LibAddonMenu-2.0\controls\header.lua
-LibAddonMenu-2.0\controls\slider.lua
-LibAddonMenu-2.0\controls\texture.lua
-LibAddonMenu-2.0\controls\iconpicker.lua
-LibAddonMenu-2.0\controls\divider.lua
diff --git a/Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.txt b/Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.txt
new file mode 100644
index 0000000..b2a7a42
--- /dev/null
+++ b/Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.txt
@@ -0,0 +1,32 @@
+## APIVersion: 100020 100021
+## Title: LibAddonMenu-2.0
+## Version: 2.0 r25
+## AddOnVersion: 25
+## Author: Seerah, sirinsidiator, et al.
+## Contributors: votan, merlight, Garkin, Randactyl, KuroiLight, silvereyes333, Baertram, kyoma
+## Description: A library to aid in the creation of option panels.
+##
+## This Add-on is not created by, affiliated with or sponsored by ZeniMax Media Inc. or its affiliates.
+## The Elder Scrolls® and related logos are registered trademarks or trademarks of ZeniMax Media Inc. in the United States and/or other countries.
+## All rights reserved
+##
+## You can read the full terms at https://account.elderscrollsonline.com/add-on-terms
+
+LibStub\LibStub.lua
+
+LibAddonMenu-2.0\LibAddonMenu-2.0.lua
+
+LibAddonMenu-2.0\controls\panel.lua
+LibAddonMenu-2.0\controls\submenu.lua
+LibAddonMenu-2.0\controls\button.lua
+LibAddonMenu-2.0\controls\checkbox.lua
+LibAddonMenu-2.0\controls\colorpicker.lua
+LibAddonMenu-2.0\controls\custom.lua
+LibAddonMenu-2.0\controls\description.lua
+LibAddonMenu-2.0\controls\dropdown.lua
+LibAddonMenu-2.0\controls\editbox.lua
+LibAddonMenu-2.0\controls\header.lua
+LibAddonMenu-2.0\controls\slider.lua
+LibAddonMenu-2.0\controls\texture.lua
+LibAddonMenu-2.0\controls\iconpicker.lua
+LibAddonMenu-2.0\controls\divider.lua
diff --git a/Libs/LibAddonMenu-2.0/LibStub.lua b/Libs/LibAddonMenu-2.0/LibStub.lua
new file mode 100644
index 0000000..0e6bf67
--- /dev/null
+++ b/Libs/LibAddonMenu-2.0/LibStub.lua
@@ -0,0 +1,38 @@
+-- LibStub is a simple versioning stub meant for use in Libraries.  http://www.wowace.com/wiki/LibStub for more info
+-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
+-- LibStub developed for World of Warcraft by above members of the WowAce community.
+-- Ported to Elder Scrolls Online by Seerah
+
+local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 4
+local LibStub = _G[LIBSTUB_MAJOR]
+
+local strformat = string.format
+if not LibStub or LibStub.minor < LIBSTUB_MINOR then
+	LibStub = LibStub or {libs = {}, minors = {} }
+	_G[LIBSTUB_MAJOR] = LibStub
+	LibStub.minor = LIBSTUB_MINOR
+
+	function LibStub:NewLibrary(major, minor)
+		assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
+		if type(minor) ~= "number" then
+			minor = assert(tonumber(zo_strmatch(minor, "%d+%.?%d*")), "Minor version must either be a number or contain a number.")
+		end
+
+		local oldminor = self.minors[major]
+		if oldminor and oldminor >= minor then return nil end
+		self.minors[major], self.libs[major] = minor, self.libs[major] or {}
+		return self.libs[major], oldminor
+	end
+
+	function LibStub:GetLibrary(major, silent)
+		if not self.libs[major] and not silent then
+			error(strformat("Cannot find a library instance of %q.", tostring(major)), 2)
+		end
+		return self.libs[major], self.minors[major]
+	end
+
+	function LibStub:IterateLibraries() return pairs(self.libs) end
+	setmetatable(LibStub, { __call = LibStub.GetLibrary })
+end
+
+LibStub.SILENT = true
\ No newline at end of file
diff --git a/Libs/LibAddonMenu-2.0/exampleoptions.lua b/Libs/LibAddonMenu-2.0/exampleoptions.lua
new file mode 100644
index 0000000..3b02d44
--- /dev/null
+++ b/Libs/LibAddonMenu-2.0/exampleoptions.lua
@@ -0,0 +1,119 @@
+local panelData = {
+    type = "panel",
+    name = "Window Title",
+    displayName = "Longer Window Title",
+    author = "Seerah",
+    version = "1.3",
+    slashCommand = "/myaddon",	--(optional) will register a keybind to open to this panel
+    registerForRefresh = true,	--boolean (optional) (will refresh all options controls when a setting is changed and when the panel is shown)
+    registerForDefaults = true,	--boolean (optional) (will set all options controls back to default values)
+}
+
+local optionsTable = {
+    [1] = {
+        type = "header",
+        name = "My Header",
+        width = "full",	--or "half" (optional)
+    },
+    [2] = {
+        type = "description",
+        --title = "My Title",	--(optional)
+        title = nil,	--(optional)
+        text = "My description text to display. blah blah blah blah blah blah blah - even more sample text!!",
+        width = "full",	--or "half" (optional)
+    },
+    [3] = {
+        type = "dropdown",
+        name = "My Dropdown",
+        tooltip = "Dropdown's tooltip text.",
+        choices = {"table", "of", "choices"},
+        getFunc = function() return "of" end,
+        setFunc = function(var) print(var) end,
+        width = "half",	--or "half" (optional)
+        warning = "Will need to reload the UI.",	--(optional)
+    },
+    [4] = {
+        type = "dropdown",
+        name = "My Dropdown",
+        tooltip = "Dropdown's tooltip text.",
+        choices = {"table", "of", "choices"},
+        getFunc = function() return "of" end,
+        setFunc = function(var) print(var) end,
+        width = "half",	--or "half" (optional)
+        warning = "Will need to reload the UI.",	--(optional)
+    },
+    [5] = {
+        type = "slider",
+        name = "My Slider",
+        tooltip = "Slider's tooltip text.",
+        min = 0,
+        max = 20,
+        step = 1,	--(optional)
+        getFunc = function() return 3 end,
+        setFunc = function(value) d(value) end,
+        width = "half",	--or "half" (optional)
+        default = 5,	--(optional)
+    },
+    [6] = {
+        type = "button",
+        name = "My Button",
+        tooltip = "Button's tooltip text.",
+        func = function() d("button pressed!") end,
+        width = "half",	--or "half" (optional)
+        warning = "Will need to reload the UI.",	--(optional)
+    },
+    [7] = {
+        type = "submenu",
+        name = "Submenu Title",
+        tooltip = "My submenu tooltip",	--(optional)
+        controls = {
+            [1] = {
+                type = "checkbox",
+                name = "My Checkbox",
+                tooltip = "Checkbox's tooltip text.",
+                getFunc = function() return true end,
+                setFunc = function(value) d(value) end,
+                width = "half",	--or "half" (optional)
+                warning = "Will need to reload the UI.",	--(optional)
+            },
+            [2] = {
+                type = "colorpicker",
+                name = "My Color Picker",
+                tooltip = "Color Picker's tooltip text.",
+                getFunc = function() return 1, 0, 0, 1 end,	--(alpha is optional)
+                setFunc = function(r,g,b,a) print(r, g, b, a) end,	--(alpha is optional)
+                width = "half",	--or "half" (optional)
+                warning = "warning text",
+            },
+            [3] = {
+                type = "editbox",
+                name = "My Editbox",
+                tooltip = "Editbox's tooltip text.",
+                getFunc = function() return "this is some text" end,
+                setFunc = function(text) print(text) end,
+                isMultiline = false,	--boolean
+                width = "half",	--or "half" (optional)
+                warning = "Will need to reload the UI.",	--(optional)
+                default = "",	--(optional)
+            },
+        },
+    },
+    [8] = {
+        type = "custom",
+        reference = "MyAddonCustomControl",	--unique name for your control to use as reference
+        refreshFunc = function(customControl) end,	--(optional) function to call when panel/controls refresh
+        width = "half",	--or "half" (optional)
+    },
+    [9] = {
+        type = "texture",
+        image = "EsoUI\\Art\\ActionBar\\abilityframe64_up.dds",
+        imageWidth = 64,	--max of 250 for half width, 510 for full
+        imageHeight = 64,	--max of 100
+        tooltip = "Image's tooltip text.",	--(optional)
+        width = "half",	--or "half" (optional)
+    },
+}
+
+local LAM = LibStub("LibAddonMenu-2.0")
+LAM:RegisterAddonPanel("MyAddon", panelData)
+LAM:RegisterOptionControls("MyAddon", optionsTable)
diff --git a/Libs/LibJarthSharedBase/LibJarthSharedBase.lua b/Libs/LibJarthSharedBase/LibJarthSharedBase.lua
new file mode 100644
index 0000000..b2c9d13
--- /dev/null
+++ b/Libs/LibJarthSharedBase/LibJarthSharedBase.lua
@@ -0,0 +1,30 @@
+--[[
+Author: Jarth
+Filename: LibJarthSharedBase.lua
+]] --
+
+-------------------------------------------------------------------------------------------------
+-- VARIABLES --
+-------------------------------------------------------------------------------------------------
+JarthSharedBase = {}
+local sharedBaseModule = JarthSharedBase
+
+-------------------------------------------------------------------------------------------------
+-- FUNCTIONS --
+-------------------------------------------------------------------------------------------------
+function sharedBaseModule:RestorePosition(baseModule, frame)
+    local Top = baseModule.Saved.Top
+    local Left = baseModule.Saved.Left
+
+    frame:ClearAnchors()
+    frame:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, Left, Top)
+end
+
+function sharedBaseModule:GetVersion(baseModule, showMinor)
+    if showMinor == false or ADDON_MINOR_VERSION == nil then
+        return tostring(baseModule.Addon.Version)
+    end
+
+    return tostring(baseModule.Addon.Version) .. "." .. tostring(baseModule.Addon.MinorVersion)
+end
+
diff --git a/Libs/LibJarthSharedBase/LibJarthSharedBase.txt b/Libs/LibJarthSharedBase/LibJarthSharedBase.txt
new file mode 100644
index 0000000..60c6831
--- /dev/null
+++ b/Libs/LibJarthSharedBase/LibJarthSharedBase.txt
@@ -0,0 +1,23 @@
+; This Add-on is not created by, affiliated with or sponsored by ZeniMax
+; Media Inc. or its affiliates. The Elder Scrolls® and related logos are
+; registered trademarks or trademarks of ZeniMax Media Inc. in the United
+; States and/or other countries. All rights reserved.
+; You can read the full terms at https://account.elderscrollsonline.com/add-on-terms
+
+## APIVersion: 100022 100023
+## Title: LibJarthSharedBase
+## Version: 1.0.1
+## Author: Jarth
+## Description: LibJarthSharedBase
+##
+## This Add-on is not created by, affiliated with or sponsored by ZeniMax Media Inc. or its affiliates.
+## The Elder Scrolls® and related logos are registered trademarks or trademarks of ZeniMax Media Inc. in the United States and/or other countries.
+## All rights reserved
+##
+## You can read the full terms at https://account.elderscrollsonline.com/add-on-terms
+
+libs\LibJarthSharedBase\LibJarthSharedBase.lua
+libs\LibJarthSharedBase\LibJarthSharedBase_Hotkeys.lua
+libs\LibJarthSharedBase\LibJarthSharedBase_Fragments.lua
+libs\LibJarthSharedBase\LibJarthSharedBase_Move.lua
+libs\LibJarthSharedBase\LibJarthSharedBase_Buttons.lua
\ No newline at end of file
diff --git a/Libs/LibJarthSharedBase/LibJarthSharedBase_Buttons.lua b/Libs/LibJarthSharedBase/LibJarthSharedBase_Buttons.lua
new file mode 100644
index 0000000..ccecba6
--- /dev/null
+++ b/Libs/LibJarthSharedBase/LibJarthSharedBase_Buttons.lua
@@ -0,0 +1,109 @@
+--[[
+Author: Jarth
+Filename: LibJarthSharedBase_Buttons.lua
+]] --
+
+-------------------------------------------------------------------------------------------------
+-- VARIABLES --
+-------------------------------------------------------------------------------------------------
+local sharedBaseModule = JarthSharedBase
+
+-------------------------------------------------------------------------------------------------
+-- FUNCTIONS --
+-------------------------------------------------------------------------------------------------
+function sharedBaseModule:SetFrameSettings(frame, isHidden, height, width)
+    if frame ~= nil then
+        frame:SetHidden(isHidden)
+        frame:SetHeight(height)
+        frame:SetWidth(width)
+    end
+end
+
+function sharedBaseModule.ButtonHighlightEnter(frame)
+    local highlightColor = frame.Saved.HighlightColor
+    local buttonBackdrop = GetControl(frame, "Backdrop")
+
+    if buttonBackdrop ~= nil then
+        if frame.Saved.IsAudioEnabled then
+            PlaySound(SOUNDS.QUICKSLOT_MOUSEOVER)
+        end
+
+        buttonBackdrop:SetEdgeColor(highlightColor.r, highlightColor.g, highlightColor.b, highlightColor.a)
+    end
+end
+
+function sharedBaseModule.ButtonHighlightExit(frame)
+    local edgeColor = frame.Saved.EdgeColor
+    local buttonBackdrop = GetControl(frame, "Backdrop")
+
+    if buttonBackdrop ~= nil then
+        buttonBackdrop:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)
+    end
+end
+
+function sharedBaseModule:GetButtonPosition(baseModule, index)
+    local left = baseModule.Saved.Width * ((index - 1) % baseModule.Saved.BarDepth)
+    local top = baseModule.Saved.Height * (math.floor((index - 1) / baseModule.Saved.BarDepth))
+
+    if not baseModule.Saved.Horizontal then
+        left = baseModule.Saved.Width * (math.floor((index - 1) / baseModule.Saved.BarDepth))
+        top = baseModule.Saved.Height * ((index - 1) % baseModule.Saved.BarDepth)
+    end
+
+    return left, top
+end
+
+function sharedBaseModule:SetupButton(baseModule, key, left, top, position)
+    local button = baseModule.Buttons[key]
+    button:ClearAnchors()
+    button:SetAnchor(position, baseModule.Frame, position, left, top)
+    button:SetHeight(baseModule.Saved.Height)
+    button:SetWidth(baseModule.Saved.Width)
+    button:SetHidden(false)
+end
+
+function sharedBaseModule:SetupButtonBinding(baseModule, key)
+    local button = baseModule.Buttons[key]
+    local buttonBinding = GetControl(button, "Binding")
+
+    if buttonBinding ~= nil and baseModule.Saved.ShowKeyBinding then
+        sharedBaseModule:HotkeyUpdateColor(baseModule, buttonBinding)
+        buttonBinding:SetText(sharedBaseModule:HotkeyGetKey(baseModule, key))
+        buttonBinding:SetDrawLevel(3)
+        buttonBinding:ClearAnchors()
+        buttonBinding:SetAnchor(baseModule.Saved.KeyBindingLocation, button, baseModule.Saved.KeyBindingLocation, 0, 0)
+    end
+
+    if buttonBinding ~= nil then
+        buttonBinding:SetHidden(not baseModule.Saved.ShowKeyBinding)
+    end
+end
+
+function sharedBaseModule:SetupButtonTexture(baseModule, key, left, top, collection, position)
+    local button = baseModule.Buttons[key]
+    local buttonTexture = GetControl(button, "Texture")
+
+    if buttonTexture ~= nil then
+        button:SetHandler("OnClicked", baseModule.ButtonOnClicked)
+        buttonTexture:SetDrawLevel(3)
+        buttonTexture:SetTexture(collection[key].EnabledTexture)
+        buttonTexture:ClearAnchors()
+        buttonTexture:SetAnchor(position, baseModule.Frame, position, left + baseModule.Saved.Margin, top + baseModule.Saved.Margin)
+        buttonTexture:SetHeight(button:GetHeight() - (2 * baseModule.Saved.Margin))
+        buttonTexture:SetWidth(button:GetWidth() - (2 * baseModule.Saved.Margin))
+    end
+end
+
+function sharedBaseModule:SetupButtonBackdrop(baseModule, key, left, top, position)
+    local button = baseModule.Buttons[key]
+    local buttonBackdrop = GetControl(button, "Backdrop")
+
+    if buttonBackdrop ~= nil then
+        buttonBackdrop:SetDrawLevel(2)
+        buttonBackdrop:SetEdgeTexture(nil, 1, 1, baseModule.Saved.Margin)
+        buttonBackdrop:ClearAnchors()
+        buttonBackdrop:SetAnchor(position, baseModule.Frame, position, left, top)
+        buttonBackdrop:SetHeight(button:GetHeight())
+        buttonBackdrop:SetWidth(button:GetWidth())
+    end
+end
diff --git a/Libs/LibJarthSharedBase/LibJarthSharedBase_Fragments.lua b/Libs/LibJarthSharedBase/LibJarthSharedBase_Fragments.lua
new file mode 100644
index 0000000..3df6d24
--- /dev/null
+++ b/Libs/LibJarthSharedBase/LibJarthSharedBase_Fragments.lua
@@ -0,0 +1,54 @@
+--[[
+Author: Jarth
+Filename: LibJarthSharedBase_Fragments.lua
+]] --
+
+-------------------------------------------------------------------------------------------------
+-- VARIABLES --
+-------------------------------------------------------------------------------------------------
+local sharedBaseModule = JarthSharedBase
+
+-------------------------------------------------------------------------------------------------
+-- FUNCTIONS --
+-------------------------------------------------------------------------------------------------
+function JarthSharedBase.HelperSetFragmentBehaviour(value, scene, fragment, statement, isHidden)
+    if scene ~= nil then
+        if value then
+            if not scene:HasFragment(fragment) then
+                scene:AddFragment(fragment)
+            end
+            -- Case when landing on a scene, before a transition
+            if statement then
+                isHidden = false
+            end
+        else
+            scene:RemoveFragment(fragment)
+        end
+    end
+    return isHidden
+end
+-------------------------------------------------------------------------------------------------
+-- PRIVATE FUNCTIONS --
+-------------------------------------------------------------------------------------------------
+function JarthSharedBase:SetFragmentBehaviour(frame, saved, fragment, isVisible)
+    local isHidden = true
+    local currentScene = SCENE_MANAGER:GetCurrentScene()
+    local currentSceneIsGameMenuInGame = currentScene ~= nil and currentScene:GetName() == "gameMenuInGame"
+
+    if fragment == nil then
+        fragment = ZO_HUDFadeSceneFragment:New(frame)
+    end
+
+    isHidden = sharedBaseModule.HelperSetFragmentBehaviour(saved.ShowBarOnHud, HUD_SCENE, fragment, currentScene == nil, isHidden)
+    isHidden = sharedBaseModule.HelperSetFragmentBehaviour(saved.ShowBarOnHudUI, HUD_UI_SCENE, fragment, false, isHidden)
+    isHidden = sharedBaseModule.HelperSetFragmentBehaviour(saved.ShowBarInMenu, SCENE_MANAGER:GetScene("gameMenuInGame"), fragment, currentSceneIsGameMenuInGame, isHidden)
+    isHidden = sharedBaseModule.HelperSetFragmentBehaviour(saved.ShowBarInInventory, SCENE_MANAGER:GetScene("inventory"), fragment, false, isHidden)
+    isHidden = sharedBaseModule.HelperSetFragmentBehaviour(saved.ShowBarInInteract, SCENE_MANAGER:GetScene("interact"), fragment, false, isHidden)
+    isHidden = sharedBaseModule.HelperSetFragmentBehaviour(saved.ShowBarInBank, SCENE_MANAGER:GetScene("bank"), fragment, false, isHidden)
+    isHidden = sharedBaseModule.HelperSetFragmentBehaviour(saved.ShowBarInFence, SCENE_MANAGER:GetScene("fence_keyboard"), fragment, false, isHidden)
+    isHidden = sharedBaseModule.HelperSetFragmentBehaviour(saved.ShowBarInStore, SCENE_MANAGER:GetScene("store"), fragment, false, isHidden)
+
+    frame:SetHidden(isHidden and not isVisible)
+
+    return fragment
+end
diff --git a/Libs/LibJarthSharedBase/LibJarthSharedBase_Hotkeys.lua b/Libs/LibJarthSharedBase/LibJarthSharedBase_Hotkeys.lua
new file mode 100644
index 0000000..ec7aa26
--- /dev/null
+++ b/Libs/LibJarthSharedBase/LibJarthSharedBase_Hotkeys.lua
@@ -0,0 +1,114 @@
+--[[
+Author: Jarth
+Filename: MementoBar_Hotkeys.lua
+]] --
+
+-------------------------------------------------------------------------------------------------
+-- VARIABLES --
+-------------------------------------------------------------------------------------------------
+local sharedBaseModule = JarthSharedBase
+
+-------------------------------------------------------------------------------------------------
+-- FUNCTIONS --
+-------------------------------------------------------------------------------------------------
+function sharedBaseModule:HotkeyGetKeyName(result, keyValue)
+    if keyValue > 0 then
+        if result ~= "" then
+            result = string.format("%s+%s", result, GetKeyName(keyValue))
+        else
+            result = GetKeyName(keyValue)
+        end
+    end
+    return result
+end
+
+function sharedBaseModule:HotkeyUpdate(baseModule, newKeyId, newCollectibleId)
+    baseModule.Global.ReverseKeyBindings = {}
+
+    for keyId, collectibleId in ipairs(baseModule.Saved.KeyBindings) do
+        if newCollectibleId and newKeyId == keyId then
+            baseModule.Saved.KeyBindings[keyId] = newCollectibleId
+            baseModule.Global.ReverseKeyBindings[newCollectibleId] = keyId
+        elseif newCollectibleId == collectibleId and newKeyId ~= keyId then
+            baseModule.Saved.KeyBindings[keyId] = 0
+        elseif collectibleId > 0 and not baseModule.Saved.SelectedMementos[collectibleId] then
+            baseModule.Saved.KeyBindings[keyId] = 0
+        elseif collectibleId > 0 then
+            baseModule.Global.ReverseKeyBindings[collectibleId] = keyId
+        end
+    end
+end
+
+function sharedBaseModule:HotkeyUpdateColor(baseModule, frame)
+    local fontColor = baseModule.Saved.FontColor
+
+    frame:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
+end
+
+function sharedBaseModule:HotKeyGetLocationValue(value)
+    local result
+
+    if value == "bottom" then
+        result = BOTTOM
+    elseif value == "bottomleft" then
+        result = BOTTOMLEFT
+    elseif value == "bottomright" then
+        result = BOTTOMRIGHT
+    elseif value == "center" then
+        result = CENTER
+    elseif value == "left" then
+        result = LEFT
+    elseif value == "right" then
+        result = RIGHT
+    elseif value == "top" then
+        result = TOP
+    elseif value == "topleft" then
+        result = TOPLEFT
+    elseif value == "topright" then
+        result = TOPRIGHT
+    end
+
+    return result
+end
+
+function sharedBaseModule:HotKeyGetLocationText(value)
+    local result
+
+    if value == BOTTOM then
+        result = "bottom"
+    elseif value == BOTTOMLEFT then
+        result = "bottomleft"
+    elseif value == BOTTOMRIGHT then
+        result = "bottomright"
+    elseif value == CENTER then
+        result = "center"
+    elseif value == LEFT then
+        result = "left"
+    elseif value == RIGHT then
+        result = "right"
+    elseif value == TOP then
+        result = "top"
+    elseif value == TOPLEFT then
+        result = "topleft"
+    elseif value == TOPRIGHT then
+        result = "topright"
+    end
+
+    return result
+end
+
+function sharedBaseModule:HotkeyGetKey(baseModule, keyBinding)
+    local result = ""
+    keyBinding = baseModule.Global.ReverseKeyBindings and baseModule.Global.ReverseKeyBindings[keyBinding] or keyBinding
+
+    if keyBinding then
+        local keyBindingTable = {GetHighestPriorityActionBindingInfoFromName(baseModule.Addon.Name .. "_" .. keyBinding)}
+
+        for _, keyValue in pairs(keyBindingTable) do
+            if keyValue > 0 then
+                result = sharedBaseModule:HotkeyGetKeyName(result, keyValue)
+            end
+        end
+    end
+    return result
+end
diff --git a/Libs/LibJarthSharedBase/LibJarthSharedBase_Move.lua b/Libs/LibJarthSharedBase/LibJarthSharedBase_Move.lua
new file mode 100644
index 0000000..388c1af
--- /dev/null
+++ b/Libs/LibJarthSharedBase/LibJarthSharedBase_Move.lua
@@ -0,0 +1,154 @@
+--[[
+Author: Jarth
+Filename: LibJarthSharedBase_Move.lua
+]] --
+
+-------------------------------------------------------------------------------------------------
+-- VARIABLES --
+-------------------------------------------------------------------------------------------------
+local sharedBaseModule = JarthSharedBase
+
+-------------------------------------------------------------------------------------------------
+-- FUNCTIONS --
+-------------------------------------------------------------------------------------------------
+function sharedBaseModule:UpdateMoveFrame(baseModule, targetFrame)
+    local moveFrame = baseModule.MoveFrame
+    local onMouseEnter, onMouseExit, onMouseDown, onMouseUp = nil, nil, nil, nil
+
+    if baseModule.Global.IsMoveEnabled then
+        moveFrame = sharedBaseModule.GetOrCreateMoveFrame(baseModule, targetFrame)
+        onMouseEnter = sharedBaseModule.MoveFrameOnEnter
+        onMouseExit = sharedBaseModule.MoveFrameOnExit
+        onMouseDown = sharedBaseModule.MoveFrameOnDown
+        onMouseUp = sharedBaseModule.MoveFrameOnUp
+    end
+
+    if moveFrame then
+        moveFrame:SetHandler("OnMouseEnter", onMouseEnter)
+        moveFrame:SetHandler("OnMouseExit", onMouseExit)
+        moveFrame:SetHandler("OnMouseDown", onMouseDown)
+        moveFrame:SetHandler("OnMouseUp", onMouseUp)
+        moveFrame:SetHidden(not baseModule.Global.IsMoveEnabled)
+        moveFrame.overlay:SetHidden(not baseModule.Global.IsMoveEnabled)
+        moveFrame.labelCenter:SetHidden(not baseModule.Global.IsMoveEnabled)
+        moveFrame.labelTopLeft:SetHidden(not baseModule.Global.IsMoveEnabled)
+        moveFrame.MoveFrameUpdateText(moveFrame)
+        moveFrame.MoveFrameUpdateColor(moveFrame)
+        moveFrame.MoveFrameAnchorToTarget(moveFrame, moveFrame.TargetFrame)
+    end
+end
+
+-------------------------------------------------------------------------------------------------
+-- FUNCTIONS --
+-- Move handlers --
+-------------------------------------------------------------------------------------------------
+function sharedBaseModule.GetOrCreateMoveFrame(baseModule, targetFrame)
+    if baseModule.MoveFrame == nil then
+        local newMoveFrame = baseModule.WM:CreateControlFromVirtual(nil, GuiRoot, baseModule.Addon.Name .. "_MoveFrame")
+
+        --Variable is used to define what savedVariable the Frame refers to.
+        newMoveFrame.TargetFrame = targetFrame
+        newMoveFrame.Saved = baseModule.Saved
+
+        newMoveFrame["MoveFrameAnchorToTarget"] = sharedBaseModule.MoveFrameAnchorToTarget
+        newMoveFrame["MoveFrameGetSnapPosition"] = sharedBaseModule.MoveFrameGetSnapPosition
+        newMoveFrame["MoveFrameUpdateText"] = sharedBaseModule.MoveFrameUpdateText
+        newMoveFrame["MoveFrameUpdateColor"] = sharedBaseModule.MoveFrameUpdateColor
+        newMoveFrame["MoveFrameOnUpdate"] = sharedBaseModule.MoveFrameOnUpdate
+        newMoveFrame["MoveFrameStorePosition"] = sharedBaseModule.MoveFrameStorePosition
+
+        newMoveFrame:SetDimensions(targetFrame:GetWidth(), targetFrame:GetHeight())
+        newMoveFrame:SetDrawLayer(4)
+        newMoveFrame:SetParent(GuiRoot)
+        newMoveFrame:SetMouseEnabled(true)
+        newMoveFrame:SetMovable(true)
+        newMoveFrame:SetClampedToScreen(true)
+
+        -- overlay
+        newMoveFrame.overlay = baseModule.WM:CreateControl(nil, newMoveFrame, CT_BACKDROP)
+        newMoveFrame.overlay:SetDrawLevel(2)
+        newMoveFrame.overlay:SetAnchorFill(targetFrame)
+        newMoveFrame.overlay:SetEdgeTexture("", 8, 1, 0)
+        -- label
+        newMoveFrame.labelCenter = baseModule.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
+        newMoveFrame.labelCenter:SetDrawLevel(3)
+        newMoveFrame.labelCenter:SetAnchorFill(targetFrame)
+        newMoveFrame.labelCenter:SetFont("ZoFontWinH5")
+        newMoveFrame.labelCenter:SetHorizontalAlignment(1)
+        newMoveFrame.labelCenter:SetVerticalAlignment(1)
+
+        newMoveFrame.labelTopLeft = baseModule.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
+        newMoveFrame.labelTopLeft:SetDrawLevel(3)
+        newMoveFrame.labelTopLeft:SetAnchorFill(targetFrame)
+        newMoveFrame.labelTopLeft:SetFont("ZoFontWinH5")
+        newMoveFrame.labelTopLeft:SetHorizontalAlignment(0)
+        newMoveFrame.labelTopLeft:SetVerticalAlignment(0)
+
+        baseModule.MoveFrame = newMoveFrame
+    end
+
+    return baseModule.MoveFrame
+end
+
+function sharedBaseModule.MoveFrameOnEnter(frame)
+    frame.MoveFrameUpdateText(frame, true)
+end
+
+function sharedBaseModule.MoveFrameOnExit(frame)
+    frame.MoveFrameUpdateText(frame, false)
+end
+
+function sharedBaseModule.MoveFrameOnDown(frame)
+    frame:SetHandler("OnUpdate", frame.MoveFrameOnUpdate)
+end
+
+function sharedBaseModule.MoveFrameOnUp(frame)
+    frame.MoveFrameOnUpdate(frame)
+    frame.MoveFrameUpdateText(frame, false)
+    frame:SetHandler("OnUpdate", nil)
+    frame.MoveFrameStorePosition(frame)
+end
+
+function sharedBaseModule.MoveFrameOnUpdate(frame)
+    frame.TargetFrame:ClearAnchors()
+    frame.TargetFrame:SetAnchor(TOPLeft, GuiRoot, TOPLeft, sharedBaseModule.MoveFrameGetSnapPosition(frame, frame:GetLeft()), sharedBaseModule.MoveFrameGetSnapPosition(frame, frame:GetTop()))
+    frame.MoveFrameUpdateText(frame, true)
+end
+
+function sharedBaseModule.MoveFrameUpdateText(frame, position)
+    local labelTextTopLeft = ""
+
+    frame.labelCenter:SetText(string.format("%s,%s", frame:GetWidth(), frame:GetHeight()))
+
+    if (position) then
+        labelTextTopLeft = string.format("%s,%s", frame.TargetFrame:GetLeft(), frame.TargetFrame:GetTop())
+    end
+
+    frame.labelTopLeft:SetText(labelTextTopLeft)
+end
+
+function sharedBaseModule.MoveFrameGetSnapPosition(frame, value)
+    return (zo_round(value / frame.Saved.SnapSize) * frame.Saved.SnapSize)
+end
+
+function sharedBaseModule.MoveFrameStorePosition(frame)
+    frame.Saved.Top = frame.MoveFrameGetSnapPosition(frame, frame:GetTop())
+    frame.Saved.Left = frame.MoveFrameGetSnapPosition(frame, frame:GetLeft())
+end
+
+function sharedBaseModule.MoveFrameAnchorToTarget(frame, target)
+    frame:ClearAnchors()
+    frame:SetDimensions(target:GetWidth(), target:GetHeight())
+    frame:SetAnchor(TOPLeft, GuiRoot, TOPLeft, target:GetLeft(), target:GetTop())
+end
+
+function sharedBaseModule.MoveFrameUpdateColor(frame)
+    local centerColor = frame.Saved.CenterColor
+    local edgeColor = frame.Saved.EdgeColor
+    local fontColor = frame.Saved.FontColor
+
+    frame.overlay:SetCenterColor(centerColor.r, centerColor.g, centerColor.b, centerColor.a)
+    frame.overlay:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)
+    frame.labelCenter:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
+    frame.labelTopLeft:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
+end
diff --git a/Libs/exampleoptions.lua b/Libs/exampleoptions.lua
deleted file mode 100644
index 3b02d44..0000000
--- a/Libs/exampleoptions.lua
+++ /dev/null
@@ -1,119 +0,0 @@
-local panelData = {
-    type = "panel",
-    name = "Window Title",
-    displayName = "Longer Window Title",
-    author = "Seerah",
-    version = "1.3",
-    slashCommand = "/myaddon",	--(optional) will register a keybind to open to this panel
-    registerForRefresh = true,	--boolean (optional) (will refresh all options controls when a setting is changed and when the panel is shown)
-    registerForDefaults = true,	--boolean (optional) (will set all options controls back to default values)
-}
-
-local optionsTable = {
-    [1] = {
-        type = "header",
-        name = "My Header",
-        width = "full",	--or "half" (optional)
-    },
-    [2] = {
-        type = "description",
-        --title = "My Title",	--(optional)
-        title = nil,	--(optional)
-        text = "My description text to display. blah blah blah blah blah blah blah - even more sample text!!",
-        width = "full",	--or "half" (optional)
-    },
-    [3] = {
-        type = "dropdown",
-        name = "My Dropdown",
-        tooltip = "Dropdown's tooltip text.",
-        choices = {"table", "of", "choices"},
-        getFunc = function() return "of" end,
-        setFunc = function(var) print(var) end,
-        width = "half",	--or "half" (optional)
-        warning = "Will need to reload the UI.",	--(optional)
-    },
-    [4] = {
-        type = "dropdown",
-        name = "My Dropdown",
-        tooltip = "Dropdown's tooltip text.",
-        choices = {"table", "of", "choices"},
-        getFunc = function() return "of" end,
-        setFunc = function(var) print(var) end,
-        width = "half",	--or "half" (optional)
-        warning = "Will need to reload the UI.",	--(optional)
-    },
-    [5] = {
-        type = "slider",
-        name = "My Slider",
-        tooltip = "Slider's tooltip text.",
-        min = 0,
-        max = 20,
-        step = 1,	--(optional)
-        getFunc = function() return 3 end,
-        setFunc = function(value) d(value) end,
-        width = "half",	--or "half" (optional)
-        default = 5,	--(optional)
-    },
-    [6] = {
-        type = "button",
-        name = "My Button",
-        tooltip = "Button's tooltip text.",
-        func = function() d("button pressed!") end,
-        width = "half",	--or "half" (optional)
-        warning = "Will need to reload the UI.",	--(optional)
-    },
-    [7] = {
-        type = "submenu",
-        name = "Submenu Title",
-        tooltip = "My submenu tooltip",	--(optional)
-        controls = {
-            [1] = {
-                type = "checkbox",
-                name = "My Checkbox",
-                tooltip = "Checkbox's tooltip text.",
-                getFunc = function() return true end,
-                setFunc = function(value) d(value) end,
-                width = "half",	--or "half" (optional)
-                warning = "Will need to reload the UI.",	--(optional)
-            },
-            [2] = {
-                type = "colorpicker",
-                name = "My Color Picker",
-                tooltip = "Color Picker's tooltip text.",
-                getFunc = function() return 1, 0, 0, 1 end,	--(alpha is optional)
-                setFunc = function(r,g,b,a) print(r, g, b, a) end,	--(alpha is optional)
-                width = "half",	--or "half" (optional)
-                warning = "warning text",
-            },
-            [3] = {
-                type = "editbox",
-                name = "My Editbox",
-                tooltip = "Editbox's tooltip text.",
-                getFunc = function() return "this is some text" end,
-                setFunc = function(text) print(text) end,
-                isMultiline = false,	--boolean
-                width = "half",	--or "half" (optional)
-                warning = "Will need to reload the UI.",	--(optional)
-                default = "",	--(optional)
-            },
-        },
-    },
-    [8] = {
-        type = "custom",
-        reference = "MyAddonCustomControl",	--unique name for your control to use as reference
-        refreshFunc = function(customControl) end,	--(optional) function to call when panel/controls refresh
-        width = "half",	--or "half" (optional)
-    },
-    [9] = {
-        type = "texture",
-        image = "EsoUI\\Art\\ActionBar\\abilityframe64_up.dds",
-        imageWidth = 64,	--max of 250 for half width, 510 for full
-        imageHeight = 64,	--max of 100
-        tooltip = "Image's tooltip text.",	--(optional)
-        width = "half",	--or "half" (optional)
-    },
-}
-
-local LAM = LibStub("LibAddonMenu-2.0")
-LAM:RegisterAddonPanel("MyAddon", panelData)
-LAM:RegisterOptionControls("MyAddon", optionsTable)
diff --git a/MementoBar.lua b/MementoBar.lua
index 99b5c57..ff3f5fa 100644
--- a/MementoBar.lua
+++ b/MementoBar.lua
@@ -7,6 +7,7 @@ Filename: MementoBar.lua
 -- VARIABLES --
 -------------------------------------------------------------------------------------------------
 local baseModule = MementoBar
+local sharedBaseModule = JarthSharedBase

 -------------------------------------------------------------------------------------------------
 --  FUNCTIONS --
@@ -26,9 +27,8 @@ function baseModule:Initialize()
         baseModule.Saved = ZO_SavedVars:NewAccountWide("MementoBar_Account", baseModule.Addon.Version, nil, baseModule.Default)
     end

-    MementoBar_Frame:SetHandler("OnMoveStop", baseModule.OnMoveStop)
-    baseModule:RestorePanel()
-    baseModule:HoykeyCreateSelections()
+    baseModule:RestorePanel(baseModule.Frame)
+    baseModule:HotkeyCreateSelections()
     baseModule:CreateSettingsWindow()

     EVENT_MANAGER:UnregisterForEvent(baseModule.Addon.Name, EVENT_ADD_ON_LOADED)
@@ -38,30 +38,14 @@ end
 --  PRIVATE FUNCTIONS --
 -------------------------------------------------------------------------------------------------

-function baseModule:GetVersion(showMinor)
-    if showMinor == false or ADDON_MINOR_VERSION == nil then
-        return tostring(baseModule.Addon.Version)
-    end
-
-    return tostring(baseModule.Addon.Version) .. "." .. tostring(baseModule.Addon.MinorVersion)
-end
-
-function baseModule:RestorePanel()
-    baseModule:SetButtonFrameWidth()
-    baseModule:HotkeyUpdate()
-    baseModule:InitializeButtons()
-    baseModule:RestoreButtons()
-    baseModule:RestorePosition()
-    baseModule:UpdateMoveFrame()
-    baseModule:SetFragmentBehaviour()
-end
-
-function baseModule:RestorePosition()
-    local Top = baseModule.Saved.Top
-    local Left = baseModule.Saved.Left
-
-    MementoBar_Frame:ClearAnchors()
-    MementoBar_Frame:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, Left, Top)
+function baseModule:RestorePanel(frame)
+    baseModule:SetButtonFrameWidth(baseModule.Saved.SelectedMementos)
+    sharedBaseModule:HotkeyUpdate(baseModule)
+    baseModule:InitializeButtons(frame, baseModule.OrderedMementos)
+    baseModule:RestoreButtons(baseModule.OrderedMementos)
+    sharedBaseModule:RestorePosition(baseModule, frame)
+    sharedBaseModule:UpdateMoveFrame(baseModule, frame)
+    baseModule.Fragment = sharedBaseModule:SetFragmentBehaviour(frame, baseModule.Saved, baseModule.Fragment)
 end

 EVENT_MANAGER:RegisterForEvent(baseModule.Addon.Name, EVENT_ADD_ON_LOADED, baseModule.OnAddOnLoaded)
diff --git a/MementoBar.txt b/MementoBar.txt
index d3a1dfb..1ed3b32 100644
--- a/MementoBar.txt
+++ b/MementoBar.txt
@@ -4,9 +4,9 @@
 ; States and/or other countries. All rights reserved.
 ; You can read the full terms at https://account.elderscrollsonline.com/add-on-terms

-## APIVersion: 100022
+## APIVersion: 100022 100023
 ## Title: Memento Bar
-## Version: 1.6.1
+## Version: 1.7.0
 ## Author: Jarth
 ## Description: Show a hotbar with selected memento's. Activate by button press!
 ##
@@ -36,12 +36,17 @@ libs\LibAddonMenu-2.0\controls\texture.lua
 libs\LibAddonMenu-2.0\controls\iconpicker.lua
 libs\LibAddonMenu-2.0\controls\divider.lua

+## OptionalDependsOn: LibJarthSharedBase
+libs\LibJarthSharedBase\LibJarthSharedBase.lua
+libs\LibJarthSharedBase\LibJarthSharedBase_Hotkeys.lua
+libs\LibJarthSharedBase\LibJarthSharedBase_Fragments.lua
+libs\LibJarthSharedBase\LibJarthSharedBase_Move.lua
+libs\LibJarthSharedBase\LibJarthSharedBase_Buttons.lua
+
+MementoBar.xml
 MementoBar_Constants.lua
-MementoBar_Fragments.lua
 MementoBar_Hotkeys.lua
 MementoBar_Menu.lua
-MementoBar_Move.lua
 MementoBar_Buttons.lua
 MementoBar.lua
-MementoBar.xml
 Bindings.xml
\ No newline at end of file
diff --git a/MementoBar_Buttons.lua b/MementoBar_Buttons.lua
index 7472666..938a277 100644
--- a/MementoBar_Buttons.lua
+++ b/MementoBar_Buttons.lua
@@ -7,33 +7,12 @@ Filename: MementoBar_Buttons.lua
 -- VARIABLES --
 -------------------------------------------------------------------------------------------------
 local baseModule = MementoBar
+local sharedBaseModule = JarthSharedBase

 -------------------------------------------------------------------------------------------------
 -- FUNCTIONS --
 -- Button highlight --
 -------------------------------------------------------------------------------------------------
-function baseModule.ButtonHighlightEnter(frame)
-    local highlightColor = baseModule.Saved.HighlightColor
-    local buttonBackdrop = GetControl(frame, "Backdrop")
-
-    if buttonBackdrop ~= nil then
-        if baseModule.Saved.IsAudioEnabled then
-            PlaySound(SOUNDS.QUICKSLOT_MOUSEOVER)
-        end
-
-        buttonBackdrop:SetEdgeColor(highlightColor.r, highlightColor.g, highlightColor.b, highlightColor.a)
-    end
-end
-
-function baseModule.ButtonHighlightExit(frame)
-    local edgeColor = baseModule.Saved.EdgeColor
-    local buttonBackdrop = GetControl(frame, "Backdrop")
-
-    if buttonBackdrop ~= nil then
-        buttonBackdrop:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)
-    end
-end
-
 function baseModule.ButtonOnClicked(button)
     local id = button:GetId()

@@ -48,103 +27,46 @@ end
 -------------------------------------------------------------------------------------------------
 -- PRIVATE FUNCTIONS --
 -------------------------------------------------------------------------------------------------
-function baseModule:SetupButton(button, left, top)
-    button:ClearAnchors()
-    button:SetAnchor(TOPLEFT, MementoBar_Frame, TOPLEFT, left, top)
-    button:SetHeight(baseModule.Saved.Height)
-    button:SetWidth(baseModule.Saved.Width)
-    button:SetHidden(false)
-end
-
-function baseModule:SetupButtonBinding(button, key, left, top)
-    local buttonBinding = GetControl(button, "Binding")

-    if buttonBinding ~= nil then
-        baseModule:HotkeyUpdateColor(buttonBinding)
-        buttonBinding:SetText(baseModule:HoykeyGetKey(button, key))
-        buttonBinding:SetDrawLevel(3)
-        buttonBinding:ClearAnchors()
-        buttonBinding:SetAnchor(baseModule.Saved.KeyBindingLocation, button, baseModule.Saved.KeyBindingLocation, 0, 0)
-    end
-
-    if buttonBinding ~= nil then
-        buttonBinding:SetHidden(not baseModule.Saved.ShowKeyBinding)
-    end
-end
+function baseModule:SetButtonFrameWidth(collection)
+    local count, height, width = 0, 0, 0

-function baseModule:SetupButtonTexture(button, key, left, top)
-    local buttonTexture = GetControl(button, "Texture")
-
-    if buttonTexture ~= nil then
-        button:SetHandler("OnClicked", baseModule.ButtonOnClicked)
-        buttonTexture:SetDrawLevel(3)
-        buttonTexture:SetTexture(baseModule.Mementos[key].EnabledTexture)
-        buttonTexture:ClearAnchors()
-        buttonTexture:SetAnchor(TOPLEFT, button, TOPLEFT, baseModule.Saved.Margin, baseModule.Saved.Margin)
-        buttonTexture:SetHeight(button:GetHeight() - (2 * baseModule.Saved.Margin))
-        buttonTexture:SetWidth(button:GetWidth() - (2 * baseModule.Saved.Margin))
-    end
-end
-
-function baseModule:SetupButtonBackdrop(button, key, left, top)
-    local buttonBackdrop = GetControl(button, "Backdrop")
-
-    if buttonBackdrop ~= nil then
-        buttonBackdrop:SetDrawLevel(2)
-        buttonBackdrop:SetEdgeTexture(nil, 1, 1, baseModule.Saved.Margin)
-        buttonBackdrop:ClearAnchors()
-        buttonBackdrop:SetAnchor(TOPLEFT, MementoBar_Frame, TOPLEFT, left, top)
-        buttonBackdrop:SetHeight(button:GetHeight())
-        buttonBackdrop:SetWidth(button:GetWidth())
-    end
-end
-
-function baseModule:SetButtonFrameWidth()
-    local count, depth, height, width = 0, 0, 0, 0
-
-    for key, value in pairs(baseModule.Saved.SelectedMementos) do
-        if IsCollectibleUnlocked(key) and baseModule.Saved.SelectedMementos[key] then
+    for key, _ in pairs(collection) do
+        if IsCollectibleUnlocked(key) and collection[key] then
             count = count + 1
         end
     end

     if count > 0 then
-        depth = math.ceil(count / baseModule.Saved.BarDepth)
-        height = baseModule.Saved.Height * (baseModule.Saved.Horizontal and baseModule.Saved.BarDepth or depth)
-        width = baseModule.Saved.Width * (baseModule.Saved.Horizontal and depth or baseModule.Saved.BarDepth)
+        local depth = math.ceil(count / baseModule.Saved.BarDepth)
+        height = baseModule.Saved.Height * (baseModule.Saved.Horizontal and depth or baseModule.Saved.BarDepth)
+        width = baseModule.Saved.Width * (not baseModule.Saved.Horizontal and depth or baseModule.Saved.BarDepth)
     end

-    baseModule:SetFrameSettings(MementoBar_Frame, count == 0, height, width)
-    baseModule:SetFrameSettings(MementoBar_FrameBackdrop, count == 0, height, width)
+    sharedBaseModule:SetFrameSettings(baseModule.Frame, count == 0, height, width)
 end

-function baseModule:SetFrameSettings(frame, isHidden, height, width)
-    if frame ~= nil then
-        frame:SetHidden(count == 0)
-        frame:SetHeight(height)
-        frame:SetWidth(width)
-    end
-end
-
-function baseModule:InitializeButtons()
+function baseModule:InitializeButtons(frame, orderedCollection)
     local index = 1
+    local position = TOPLEFT

-    for _, _value in ipairs(baseModule.OrderedMementos) do
+    for _, _value in ipairs(orderedCollection) do
         local id = _value.Id
-        local left, top = baseModule:GetButtonPosition(index)
+        local left, top = sharedBaseModule:GetButtonPosition(baseModule, index)

         if baseModule.Saved.SelectedMementos[id] and IsCollectibleUnlocked(id) then
             if baseModule.Buttons[id] == nil then
-                baseModule.Buttons[id] = baseModule.WM:CreateControlFromVirtual("MementoBar_Button", MementoBar_Frame, "MementoBar_Button", id)
+                baseModule.Buttons[id] = baseModule.WM:CreateControlFromVirtual("MementoBar_Button", frame, "MementoBar_Button", id)
+                baseModule.Buttons[id].Saved = baseModule.Saved
                 baseModule.Buttons[id]:SetId(id)
             end

-            baseModule:SetupButton(baseModule.Buttons[id], left, top)
-            baseModule:SetupButtonBinding(baseModule.Buttons[id], id, left, top)
-            baseModule:SetupButtonBackdrop(baseModule.Buttons[id], id, left, top)
-            baseModule:SetupButtonTexture(baseModule.Buttons[id], id, left, top)
-            baseModule.Buttons[id]:SetHandler("OnMouseEnter", baseModule.ButtonHighlightEnter)
-            baseModule.Buttons[id]:SetHandler("OnMouseExit", baseModule.ButtonHighlightExit)
+            sharedBaseModule:SetupButton(baseModule, id, left, top, position)
+            sharedBaseModule:SetupButtonBinding(baseModule, id)
+            sharedBaseModule:SetupButtonBackdrop(baseModule, id, left, top, position)
+            sharedBaseModule:SetupButtonTexture(baseModule, id, left, top, baseModule.Mementos, position)
+            baseModule.Buttons[id]:SetHandler("OnMouseEnter", sharedBaseModule.ButtonHighlightEnter)
+            baseModule.Buttons[id]:SetHandler("OnMouseExit", sharedBaseModule.ButtonHighlightExit)
             index = index + 1
         elseif baseModule.Buttons[id] ~= nil then
             baseModule.Buttons[id]:SetHidden(true)
@@ -152,26 +74,14 @@ function baseModule:InitializeButtons()
     end
 end

-function baseModule:GetButtonPosition(index)
-    local left = baseModule.Saved.Width * ((index - 1) % baseModule.Saved.BarDepth)
-    local top = baseModule.Saved.Height * (math.floor((index - 1) / baseModule.Saved.BarDepth))
-
-    if baseModule.Saved.Horizontal then
-        left = baseModule.Saved.Height * (math.floor((index - 1) / baseModule.Saved.BarDepth))
-        top = baseModule.Saved.Width * ((index - 1) % baseModule.Saved.BarDepth)
-    end
-
-    return left, top
-end
-
-function baseModule:RestoreButtons()
+function baseModule:RestoreButtons(orderedCollection)
     local centerColor = baseModule.Saved.CenterColor
     local edgeColor = baseModule.Saved.EdgeColor
     local timerIsTimerEnabled = baseModule.Saved.IsTimerEnabled
     local timerFont = baseModule.Saved.TimerFont
     local timerFontColor = baseModule.Saved.TimerFontColor

-    for _, _value in ipairs(baseModule.OrderedMementos) do
+    for _, _value in ipairs(orderedCollection) do
         if baseModule.Buttons[_value.Id] ~= nil then
             local backdrop = GetControl(baseModule.Buttons[_value.Id], "Backdrop")

diff --git a/MementoBar_Constants.lua b/MementoBar_Constants.lua
index d02dded..f5ea2f0 100644
--- a/MementoBar_Constants.lua
+++ b/MementoBar_Constants.lua
@@ -8,17 +8,19 @@ Filename: MementoBar_Constants.lua
 -------------------------------------------------------------------------------------------------
 MementoBar = {}
 local baseModule = MementoBar
+local sharedBaseModule = JarthSharedBase

 baseModule.Addon = {
     Name = "MementoBar",
     DisplayName = "Memento bar",
-    Version = 1.6,
-    MinorVersion = 1,
+    Version = 1.7,
+    MinorVersion = 0,
     SlashCommand = "/mb",
     Author = "Jarth",
     Website = ""
 }
 baseModule.WM = GetWindowManager()
+baseModule.Frame = MementoBar_Frame
 baseModule.Buttons = {}
 baseModule.Fragment = nil
 baseModule.Default = {
@@ -87,8 +89,17 @@ baseModule.Global = {
     }
 }

-baseModule.Global.CategoryName, _, baseModule.Global.CategoryNumCollectibles, baseModule.Global.CategoryNumUnlocked, baseModule.Global.CategoryTotal, _ =
-    GetCollectibleCategoryInfo(baseModule.Global.TopLevelIndex)
+baseModule.CountDown = {
+    Event = "Cooldown",
+    Tick = 100,
+    StartTime = 0,
+    CollectibleId = nil
+}
+
+baseModule.Global.CategoryNumUnlocked = GetTotalUnlockedCollectiblesByCategoryType(COLLECTIBLE_CATEGORY_TYPE_MEMENTO)
+
+baseModule.Global.CategoryName, _, baseModule.Global.CategoryNumCollectibles, _, baseModule.Global.CategoryTotal, _ = GetCollectibleCategoryInfo(baseModule.Global.TopLevelIndex)
+
 for index = 1, baseModule.Global.CategoryTotal do
     local collectibleId = GetCollectibleId(baseModule.Global.TopLevelIndex, nil, index)
     local collectibleName, collectibleDescription, collectibleIcon, _, collectibleUnlocked, _, _, _, collectibleHint, _ = GetCollectibleInfo(collectibleId)
@@ -100,11 +111,4 @@ for index = 1, baseModule.Global.CategoryTotal do
         Tooltip = string.format("Description: %s \nHint: %s", collectibleDescription, collectibleHint)
     }
     baseModule.OrderedMementos[index] = baseModule.Mementos[collectibleId]
-end
-
-baseModule.CountDown = {
-    Event = "Cooldown",
-    Tick = 100,
-    StartTime = 0,
-    CollectibleId = nil
-}
+end
\ No newline at end of file
diff --git a/MementoBar_Fragments.lua b/MementoBar_Fragments.lua
deleted file mode 100644
index 062eaae..0000000
--- a/MementoBar_Fragments.lua
+++ /dev/null
@@ -1,54 +0,0 @@
---[[
-Author: Jarth
-Filename: MementoBar_Fragments.lua
-]] --
-
--------------------------------------------------------------------------------------------------
--- VARIABLES --
--------------------------------------------------------------------------------------------------
-local baseModule = MementoBar
-
--------------------------------------------------------------------------------------------------
--- Helper FUNCTIONS --
--------------------------------------------------------------------------------------------------
-function baseModule:HelperSetFragmentBehaviour(value, scene, fragment, statement, frameIsHidden)
-    if value then
-        scene:AddFragment(fragment)
-
-        -- Case when landing on a scene, before a transition
-        if statement then
-            frameIsHidden = false
-        end
-    else
-        scene:RemoveFragment(fragment)
-    end
-    return frameIsHidden
-end
-
--------------------------------------------------------------------------------------------------
--- PRIVATE FUNCTIONS --
--------------------------------------------------------------------------------------------------
-function baseModule:SetFragmentBehaviour()
-    local frame = MementoBar_Frame
-    local saved = baseModule.Saved
-    local fragment = baseModule.Fragment
-    local currentScene = SCENE_MANAGER:GetCurrentScene()
-    local frameIsHidden = true
-    local currentSceneIsGameMenuInGame = currentScene ~= nil and currentScene:GetName() == "gameMenuInGame"
-
-    if fragment == nil then
-        baseModule.Fragment = ZO_HUDFadeSceneFragment:New(frame)
-        fragment = baseModule.Fragment
-    end
-
-    frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarOnHud, HUD_SCENE, fragment, currentScene == nil, frameIsHidden)
-    frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarOnHudUI, HUD_UI_SCENE, fragment, false, frameIsHidden)
-    frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInMenu, SCENE_MANAGER:GetScene("gameMenuInGame"), fragment, currentSceneIsGameMenuInGame, frameIsHidden)
-    frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInInventory, SCENE_MANAGER:GetScene("inventory"), fragment, false, frameIsHidden)
-    frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInInteract, SCENE_MANAGER:GetScene("interact"), fragment, false, frameIsHidden)
-    frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInBank, SCENE_MANAGER:GetScene("bank"), fragment, false, frameIsHidden)
-    frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInFence, SCENE_MANAGER:GetScene("fence_keyboard"), fragment, false, frameIsHidden)
-    frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInStore, SCENE_MANAGER:GetScene("store"), fragment, false, frameIsHidden)
-
-    frame:SetHidden(frameIsHidden)
-end
diff --git a/MementoBar_Hotkeys.lua b/MementoBar_Hotkeys.lua
index 5fc3fdc..7e671b3 100644
--- a/MementoBar_Hotkeys.lua
+++ b/MementoBar_Hotkeys.lua
@@ -7,6 +7,7 @@ Filename: MementoBar_Hotkeys.lua
 -- VARIABLES --
 -------------------------------------------------------------------------------------------------
 local baseModule = MementoBar
+local sharedBaseModule = JarthSharedBase

 -------------------------------------------------------------------------------------------------
 -- PUBLIC FUNCTIONS --
@@ -17,8 +18,8 @@ function MementoBar_KeyBindingPressed(keyId)
     if control ~= nil then
         for collectibleId, _ in pairs(baseModule.Saved.SelectedMementos) do
             if baseModule.Buttons[collectibleId] == control then
-                baseModule:HotkeyUpdate(keyId, collectibleId)
-                baseModule:InitializeButtons()
+                sharedBaseModule:HotkeyUpdate(baseModule, keyId, collectibleId)
+                baseModule:InitializeButtons(baseModule.Frame, baseModule.OrderedMementos)
                 return
             end
         end
@@ -32,111 +33,9 @@ end
 -------------------------------------------------------------------------------------------------
 -- PRIVATE FUNCTIONS --
 -------------------------------------------------------------------------------------------------
-function baseModule:HoykeyCreateSelections()
-    for key, value in ipairs(baseModule.Saved.KeyBindings) do
-        ZO_CreateStringId("SI_BINDING_NAME_MementoBar_" .. key, "MementoBar_" .. key)
-    end
-end
-
-function baseModule:HotkeyUpdate(newKeyId, newCollectibleId)
-    baseModule.Global.ReverseKeyBindings = {}
-
-    for keyId, collectibleId in ipairs(baseModule.Saved.KeyBindings) do
-        if newCollectibleId and newKeyId == keyId then
-            baseModule.Saved.KeyBindings[keyId] = newCollectibleId
-            baseModule.Global.ReverseKeyBindings[newCollectibleId] = keyId
-        elseif newCollectibleId == collectibleId and newKeyId ~= keyId then
-            baseModule.Saved.KeyBindings[keyId] = 0
-        elseif collectibleId > 0 and not baseModule.Saved.SelectedMementos[collectibleId] then
-            baseModule.Saved.KeyBindings[keyId] = 0
-        elseif collectibleId > 0 then
-            baseModule.Global.ReverseKeyBindings[collectibleId] = keyId
-        end
-    end
-end
-
-function baseModule:HoykeyGetKey(button, collectibleId)
-    local result = ""
-    local keyId = baseModule.Global.ReverseKeyBindings[collectibleId]
-
-    if keyId then
-        local keyBindingTable = {GetHighestPriorityActionBindingInfoFromName("MementoBar_" .. keyId)}
-        for _, keyValue in pairs(keyBindingTable) do
-            if keyValue > 0 then
-                result = baseModule:HotkeyGetKeyName(result, keyValue)
-            end
-        end
-    end
-
-    return result
-end
-
-function baseModule:HotkeyGetKeyName(result, keyValue)
-    if keyValue > 0 then
-        if result ~= "" then
-            result = string.format("%s+%s", result, GetKeyName(keyValue))
-        else
-            result = GetKeyName(keyValue)
-        end
-    end
-
-    return result
-end
-
-function baseModule:HotkeyUpdateColor(frame)
-    local fontColor = baseModule.Saved.FontColor
-
-    frame:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
-end
-
-function baseModule:HotKeyGetLocationValue(value)
-    local result

-    if value == "bottom" then
-        result = BOTTOM
-    elseif value == "bottomleft" then
-        result = BOTTOMLEFT
-    elseif value == "bottomright" then
-        result = BOTTOMRIGHT
-    elseif value == "center" then
-        result = CENTER
-    elseif value == "left" then
-        result = LEFT
-    elseif value == "right" then
-        result = RIGHT
-    elseif value == "top" then
-        result = TOP
-    elseif value == "topleft" then
-        result = TOPLEFT
-    elseif value == "topright" then
-        result = TOPRIGHT
-    end
-
-    return result
-end
-
-function baseModule:HotKeyGetLocationText(value)
-    local result
-
-    if value == BOTTOM then
-        result = "bottom"
-    elseif value == BOTTOMLEFT then
-        result = "bottomleft"
-    elseif value == BOTTOMRIGHT then
-        result = "bottomright"
-    elseif value == CENTER then
-        result = "center"
-    elseif value == LEFT then
-        result = "left"
-    elseif value == RIGHT then
-        result = "right"
-    elseif value == TOP then
-        result = "top"
-    elseif value == TOPLEFT then
-        result = "topleft"
-    elseif value == TOPRIGHT then
-        result = "topright"
+function baseModule:HotkeyCreateSelections()
+    for key, value in ipairs(baseModule.Saved.KeyBindings) do
+        ZO_CreateStringId("SI_BINDING_NAME_" .. baseModule.Addon.Name .. "_" .. key, baseModule.Addon.Name .. "_" .. key)
     end
-
-    return result
-end
+end
\ No newline at end of file
diff --git a/MementoBar_Menu.lua b/MementoBar_Menu.lua
index 98890b0..8a994d7 100644
--- a/MementoBar_Menu.lua
+++ b/MementoBar_Menu.lua
@@ -12,6 +12,7 @@ local LAM2 = LibStub:GetLibrary("LibAddonMenu-2.0")
 -- VARIABLES --
 -------------------------------------------------------------------------------------------------
 local baseModule = MementoBar
+local sharedBaseModule = JarthSharedBase

 -------------------------------------------------------------------------------------------------
 -- Menu Functions --
@@ -22,7 +23,7 @@ function baseModule:CreateSettingsWindow()
         name = baseModule.Addon.DisplayName,
         displayName = baseModule.Addon.DisplayName,
         author = baseModule.Addon.Author,
-        version = baseModule:GetVersion(true),
+        version = sharedBaseModule:GetVersion(baseModule, true),
         slashCommand = baseModule.Addon.SlashCommand,
         registerForRefresh = true,
         registerForDefaults = true
@@ -53,7 +54,7 @@ function baseModule:CreateSettingsWindow()
                     baseModule.Saved = ZO_SavedVars:New("MementoBar_Character", baseModule.Addon.Version, nil, baseModule.Default)
                 end
                 baseModule.Saved.UseAccountSettings = newValue
-                baseModule:RestorePanel()
+                baseModule:RestorePanel(baseModule.Frame)
             end
         },
         [4] = {
@@ -70,7 +71,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(value)
                         baseModule.Saved.BarDepth = value
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     min = 1,
                     max = baseModule.Global.CategoryNumUnlocked
@@ -102,7 +103,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Global.IsMoveEnabled = newValue
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end
                 },
                 [3] = {
@@ -115,7 +116,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Saved.Horizontal = newValue
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end
                 },
                 [4] = {
@@ -127,7 +128,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(value)
                         baseModule.Saved.Margin = value
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     min = 1,
                     max = 50
@@ -141,7 +142,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(value)
                         baseModule.Saved.Height = value
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     min = 1,
                     max = 100
@@ -155,7 +156,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(value)
                         baseModule.Saved.Width = value
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     min = 1,
                     max = 100
@@ -169,7 +170,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(value)
                         baseModule.Saved.SnapSize = value
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     min = 1,
                     max = 10
@@ -184,7 +185,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Saved.ShowKeyBinding = newValue
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     width = "half"
                 },
@@ -198,11 +199,11 @@ function baseModule:CreateSettingsWindow()
                         return not baseModule.Saved.ShowKeyBinding
                     end,
                     getFunc = function()
-                        return baseModule:HotKeyGetLocationText(baseModule.Saved.KeyBindingLocation)
+                        return sharedBaseModule:HotKeyGetLocationText(baseModule.Saved.KeyBindingLocation)
                     end,
                     setFunc = function(value)
-                        baseModule.Saved.KeyBindingLocation = baseModule:HotKeyGetLocationValue(value)
-                        baseModule:RestorePanel()
+                        baseModule.Saved.KeyBindingLocation = sharedBaseModule:HotKeyGetLocationValue(value)
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     width = "half"
                 }
@@ -229,7 +230,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(r, g, b, a)
                         baseModule.Saved.CenterColor = {r = r, g = g, b = b, a = a}
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     width = "half"
                 },
@@ -245,7 +246,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(r, g, b, a)
                         baseModule.Saved.EdgeColor = {r = r, g = g, b = b, a = a}
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     width = "half"
                 },
@@ -261,7 +262,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(r, g, b, a)
                         baseModule.Saved.HighlightColor = {r = r, g = g, b = b, a = a}
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     width = "half"
                 },
@@ -275,7 +276,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(r, g, b, a)
                         baseModule.Saved.FontColor = {r = r, g = g, b = b, a = a}
-                        baseModule:RestorePanel()
+                        baseModule:RestorePanel(baseModule.Frame)
                     end,
                     width = "half"
                 }
@@ -308,78 +309,6 @@ function baseModule:CreateSettingsWindow()
         },
         [8] = {
             type = "submenu",
-            name = "Cooldown",
-            tooltip = "Setup cooldown",
-            controls = {
-                [1] = {
-                    type = "description",
-                    text = "Here you can setup the cooldown"
-                },
-                [2] = {
-                    type = "checkbox",
-                    name = "Display cooldown",
-                    tooltip = "When ON cooldown will be displayed.",
-                    default = function()
-                        return baseModule.Saved.IsTimerEnabled
-                    end,
-                    getFunc = function()
-                        return baseModule.Saved.IsTimerEnabled
-                    end,
-                    setFunc = function(newValue)
-                        baseModule.Saved.IsTimerEnabled = newValue
-                        baseModule:RestoreButtons()
-                    end
-                },
-                [3] = {
-                    type = "colorpicker",
-                    name = "Cooldown font color",
-                    tooltip = "Changes of the cooldown font color.",
-                    disabled = function()
-                        return not baseModule.Saved.IsTimerEnabled
-                    end,
-                    default = function()
-                        return baseModule.Default.TimerFontColor
-                    end,
-                    getFunc = function()
-                        baseModule:UpdateCooldownExampleText()
-                        return baseModule.Saved.TimerFontColor.r, baseModule.Saved.TimerFontColor.g, baseModule.Saved.TimerFontColor.b, baseModule.Saved.TimerFontColor.a
-                    end,
-                    setFunc = function(r, g, b, a)
-                        baseModule.Saved.TimerFontColor = {r = r, g = g, b = b, a = a}
-                        baseModule:RestoreButtons()
-                        baseModule:UpdateCooldownExampleText()
-                    end,
-                    width = "half"
-                },
-                [4] = {
-                    type = "dropdown",
-                    name = "Cooldown font",
-                    tooltip = "Select the " .. "cooldown font.",
-                    choices = baseModule.Global.TimerFonts,
-                    disabled = function()
-                        return not baseModule.Saved.IsTimerEnabled
-                    end,
-                    default = baseModule.Default.TimerFont,
-                    getFunc = function()
-                        baseModule:UpdateCooldownExampleText()
-                        return baseModule.Saved.TimerFont
-                    end,
-                    setFunc = function(value)
-                        baseModule.Saved.TimerFont = value
-                        baseModule:RestoreButtons()
-                        baseModule:UpdateCooldownExampleText()
-                    end,
-                    width = "half"
-                },
-                [5] = {
-                    type = "description",
-                    title = "Example text: 20.9s\n(Update a value to see an example)",
-                    reference = baseModule.Addon.DisplayName .. "ExampleTextControl"
-                }
-            }
-        },
-        [9] = {
-            type = "submenu",
             name = "Visibility",
             tooltip = "Setup visibility",
             controls = {
@@ -393,7 +322,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Saved.ShowBarOnHud = newValue
-                        baseModule:SetFragmentBehaviour()
+                        baseModule.Fragment = sharedBaseModule:SetFragmentBehaviour(baseModule.Frame, baseModule.Saved, baseModule.Fragment)
                     end
                 },
                 [2] = {
@@ -406,7 +335,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Saved.ShowBarOnHudUI = newValue
-                        baseModule:SetFragmentBehaviour()
+                        baseModule.Fragment = sharedBaseModule:SetFragmentBehaviour(baseModule.Frame, baseModule.Saved, baseModule.Fragment)
                     end
                 },
                 [3] = {
@@ -419,7 +348,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Saved.ShowBarInMenu = newValue
-                        baseModule:SetFragmentBehaviour()
+                        baseModule.Fragment = sharedBaseModule:SetFragmentBehaviour(baseModule.Frame, baseModule.Saved, baseModule.Fragment)
                     end
                 },
                 [4] = {
@@ -432,7 +361,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Saved.ShowBarInInventory = newValue
-                        baseModule:SetFragmentBehaviour()
+                        baseModule.Fragment = sharedBaseModule:SetFragmentBehaviour(baseModule.Frame, baseModule.Saved, baseModule.Fragment)
                     end
                 },
                 [5] = {
@@ -445,7 +374,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Saved.ShowBarInInteract = newValue
-                        baseModule:SetFragmentBehaviour()
+                        baseModule.Fragment = sharedBaseModule:SetFragmentBehaviour(baseModule.Frame, baseModule.Saved, baseModule.Fragment)
                     end
                 },
                 [6] = {
@@ -458,7 +387,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Saved.ShowBarInBank = newValue
-                        baseModule:SetFragmentBehaviour()
+                        baseModule.Fragment = sharedBaseModule:SetFragmentBehaviour(baseModule.Frame, baseModule.Saved, baseModule.Fragment)
                     end
                 },
                 [7] = {
@@ -471,7 +400,7 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Saved.ShowBarInFence = newValue
-                        baseModule:SetFragmentBehaviour()
+                        baseModule.Fragment = sharedBaseModule:SetFragmentBehaviour(baseModule.Frame, baseModule.Saved, baseModule.Fragment)
                     end
                 },
                 [8] = {
@@ -484,10 +413,82 @@ function baseModule:CreateSettingsWindow()
                     end,
                     setFunc = function(newValue)
                         baseModule.Saved.ShowBarInStore = newValue
-                        baseModule:SetFragmentBehaviour()
+                        baseModule.Fragment = sharedBaseModule:SetFragmentBehaviour(baseModule.Frame, baseModule.Saved, baseModule.Fragment)
                     end
                 }
             }
+        },
+        [9] = {
+            type = "submenu",
+            name = "Cooldown",
+            tooltip = "Setup cooldown",
+            controls = {
+                [1] = {
+                    type = "description",
+                    text = "Here you can setup the cooldown"
+                },
+                [2] = {
+                    type = "checkbox",
+                    name = "Display cooldown",
+                    tooltip = "When ON cooldown will be displayed.",
+                    default = function()
+                        return baseModule.Saved.IsTimerEnabled
+                    end,
+                    getFunc = function()
+                        return baseModule.Saved.IsTimerEnabled
+                    end,
+                    setFunc = function(newValue)
+                        baseModule.Saved.IsTimerEnabled = newValue
+                        baseModule:RestoreButtons(baseModule.OrderedMementos)
+                    end
+                },
+                [3] = {
+                    type = "colorpicker",
+                    name = "Cooldown font color",
+                    tooltip = "Changes of the cooldown font color.",
+                    disabled = function()
+                        return not baseModule.Saved.IsTimerEnabled
+                    end,
+                    default = function()
+                        return baseModule.Default.TimerFontColor
+                    end,
+                    getFunc = function()
+                        baseModule:UpdateCooldownExampleText()
+                        return baseModule.Saved.TimerFontColor.r, baseModule.Saved.TimerFontColor.g, baseModule.Saved.TimerFontColor.b, baseModule.Saved.TimerFontColor.a
+                    end,
+                    setFunc = function(r, g, b, a)
+                        baseModule.Saved.TimerFontColor = {r = r, g = g, b = b, a = a}
+                        baseModule:RestoreButtons(baseModule.OrderedMementos)
+                        baseModule:UpdateCooldownExampleText()
+                    end,
+                    width = "half"
+                },
+                [4] = {
+                    type = "dropdown",
+                    name = "Cooldown font",
+                    tooltip = "Select the " .. "cooldown font.",
+                    choices = baseModule.Global.TimerFonts,
+                    disabled = function()
+                        return not baseModule.Saved.IsTimerEnabled
+                    end,
+                    default = baseModule.Default.TimerFont,
+                    getFunc = function()
+                        baseModule:UpdateCooldownExampleText()
+                        return baseModule.Saved.TimerFont
+                    end,
+                    setFunc = function(value)
+                        baseModule.Saved.TimerFont = value
+                        baseModule:RestoreButtons(baseModule.OrderedMementos)
+                        baseModule:UpdateCooldownExampleText()
+                    end,
+                    width = "half"
+                },
+                [5] = {
+                    type = "description",
+                    title = "Example text: 20.9s\n(Update a value to see an example)",
+                    reference = baseModule.Addon.DisplayName .. "ExampleTextControl"
+                }
+            }
         }
     }

@@ -507,7 +508,7 @@ function baseModule:CreateSettingsWindow()
                 else
                     baseModule.Saved.SelectedMementos[_type.Id] = nil
                 end
-                baseModule:RestorePanel()
+                baseModule:RestorePanel(baseModule.Frame)
             end
         }
         table.insert(optionsData[4].controls, index + 2, line)
diff --git a/MementoBar_Move.lua b/MementoBar_Move.lua
deleted file mode 100644
index 16e601e..0000000
--- a/MementoBar_Move.lua
+++ /dev/null
@@ -1,154 +0,0 @@
---[[
-Author: Jarth
-Filename: MementoBar_Move.lua
-]] --
-
--------------------------------------------------------------------------------------------------
--- VARIABLES --
--------------------------------------------------------------------------------------------------
-local baseModule = MementoBar
-
--------------------------------------------------------------------------------------------------
--- FUNCTIONS --
--- Move frame --
--------------------------------------------------------------------------------------------------
-function baseModule:UpdateMoveFrame()
-    local moveFrame = baseModule.MoveFrame
-    local onMouseEnter, onMouseExit, onMouseDown, onMouseUp = nil, nil, nil, nil
-
-    if baseModule.Global.IsMoveEnabled then
-        moveFrame = baseModule:GetOrCreateMoveFrame()
-        onMouseEnter = baseModule.MoveFrameOnEnter
-        onMouseExit = baseModule.MoveFrameOnExit
-        onMouseDown = baseModule.MoveFrameOnDown
-        onMouseUp = baseModule.MoveFrameOnUp
-    end
-
-    if moveFrame then
-        moveFrame:SetHandler("OnMouseEnter", onMouseEnter)
-        moveFrame:SetHandler("OnMouseExit", onMouseExit)
-        moveFrame:SetHandler("OnMouseDown", onMouseDown)
-        moveFrame:SetHandler("OnMouseUp", onMouseUp)
-        moveFrame:SetHidden(not baseModule.Global.IsMoveEnabled)
-        moveFrame.overlay:SetHidden(not baseModule.Global.IsMoveEnabled)
-        moveFrame.labelCenter:SetHidden(not baseModule.Global.IsMoveEnabled)
-        moveFrame.labelTopLeft:SetHidden(not baseModule.Global.IsMoveEnabled)
-        moveFrame.MoveFrameUpdateText(moveFrame)
-        moveFrame.MoveFrameUpdateColor(moveFrame)
-        moveFrame.MoveFrameAnchorToTarget(moveFrame, moveFrame.TargetFrame)
-    end
-end
-
--------------------------------------------------------------------------------------------------
--- FUNCTIONS --
--- Move handlers --
--------------------------------------------------------------------------------------------------
-function baseModule:GetOrCreateMoveFrame(show)
-    if baseModule.MoveFrame == nil then
-        local newMoveFrame = baseModule.WM:CreateControlFromVirtual(nil, GuiRoot, "MementoBar_MoveFrame")
-        local targetFrame = MementoBar_Frame
-
-        --Variable is used to define what savedVariable the Frame refers to.
-        newMoveFrame.TargetFrame = targetFrame
-
-        newMoveFrame["MoveFrameAnchorToTarget"] = baseModule.MoveFrameAnchorToTarget
-        newMoveFrame["MoveFrameGetSnapPosition"] = baseModule.MoveFrameGetSnapPosition
-        newMoveFrame["MoveFrameUpdateText"] = baseModule.MoveFrameUpdateText
-        newMoveFrame["MoveFrameUpdateColor"] = baseModule.MoveFrameUpdateColor
-        newMoveFrame["MoveFrameOnUpdate"] = baseModule.MoveFrameOnUpdate
-        newMoveFrame["MoveFrameStorePosition"] = baseModule.MoveFrameStorePosition
-
-        newMoveFrame:SetDimensions(targetFrame:GetWidth(), targetFrame:GetHeight())
-        newMoveFrame:SetDrawLayer(4)
-        newMoveFrame:SetParent(GuiRoot)
-        newMoveFrame:SetMouseEnabled(true)
-        newMoveFrame:SetMovable(true)
-        newMoveFrame:SetClampedToScreen(true)
-
-        -- overlay
-        newMoveFrame.overlay = baseModule.WM:CreateControl(nil, newMoveFrame, CT_BACKDROP)
-        newMoveFrame.overlay:SetDrawLevel(2)
-        newMoveFrame.overlay:SetAnchorFill(targetFrame)
-        newMoveFrame.overlay:SetEdgeTexture("", 8, 1, 0)
-        -- label
-        newMoveFrame.labelCenter = baseModule.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
-        newMoveFrame.labelCenter:SetDrawLevel(3)
-        newMoveFrame.labelCenter:SetAnchorFill(targetFrame)
-        newMoveFrame.labelCenter:SetFont("ZoFontWinH5")
-        newMoveFrame.labelCenter:SetHorizontalAlignment(1)
-        newMoveFrame.labelCenter:SetVerticalAlignment(1)
-
-        newMoveFrame.labelTopLeft = baseModule.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
-        newMoveFrame.labelTopLeft:SetDrawLevel(3)
-        newMoveFrame.labelTopLeft:SetAnchorFill(targetFrame)
-        newMoveFrame.labelTopLeft:SetFont("ZoFontWinH5")
-        newMoveFrame.labelTopLeft:SetHorizontalAlignment(0)
-        newMoveFrame.labelTopLeft:SetVerticalAlignment(0)
-
-        baseModule.MoveFrame = newMoveFrame
-    end
-    return baseModule.MoveFrame
-end
-
-function baseModule.MoveFrameOnEnter(frame)
-    frame.MoveFrameUpdateText(frame, true)
-end
-
-function baseModule.MoveFrameOnExit(frame)
-    frame.MoveFrameUpdateText(frame, false)
-end
-
-function baseModule.MoveFrameOnDown(frame)
-    frame:SetHandler("OnUpdate", frame.MoveFrameOnUpdate)
-end
-
-function baseModule.MoveFrameOnUp(frame)
-    frame.MoveFrameOnUpdate(frame)
-    frame.MoveFrameUpdateText(frame, false)
-    frame:SetHandler("OnUpdate", nil)
-    frame.MoveFrameStorePosition(frame)
-end
-
-function baseModule.MoveFrameOnUpdate(frame)
-    frame.TargetFrame:ClearAnchors()
-    frame.TargetFrame:SetAnchor(TOPLeft, GuiRoot, TOPLeft, baseModule.MoveFrameGetSnapPosition(frame:GetLeft()), baseModule.MoveFrameGetSnapPosition(frame:GetTop()))
-    frame.MoveFrameUpdateText(frame, true)
-end
-
-function baseModule.MoveFrameUpdateText(frame, position)
-    local labelTextTopLeft = ""
-
-    frame.labelCenter:SetText(string.format("%s,%s", frame:GetWidth(), frame:GetHeight()))
-
-    if (position) then
-        labelTextTopLeft = string.format("%s,%s", frame.TargetFrame:GetLeft(), frame.TargetFrame:GetTop())
-    end
-
-    frame.labelTopLeft:SetText(labelTextTopLeft)
-end
-
-function baseModule.MoveFrameGetSnapPosition(value)
-    return (zo_round(value / baseModule.Saved.SnapSize) * baseModule.Saved.SnapSize)
-end
-
-function baseModule.MoveFrameStorePosition(frame)
-    baseModule.Saved.Top = frame.MoveFrameGetSnapPosition(frame:GetTop())
-    baseModule.Saved.Left = frame.MoveFrameGetSnapPosition(frame:GetLeft())
-end
-
-function baseModule.MoveFrameAnchorToTarget(frame, target)
-    frame:ClearAnchors()
-    frame:SetDimensions(target:GetWidth(), target:GetHeight())
-    frame:SetAnchor(TOPLeft, GuiRoot, TOPLeft, target:GetLeft(), target:GetTop())
-end
-
-function baseModule.MoveFrameUpdateColor(frame)
-    local centerColor = baseModule.Saved.CenterColor
-    local edgeColor = baseModule.Saved.EdgeColor
-    local fontColor = baseModule.Saved.FontColor
-
-    frame.overlay:SetCenterColor(centerColor.r, centerColor.g, centerColor.b, centerColor.a)
-    frame.overlay:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)
-    frame.labelCenter:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
-    frame.labelTopLeft:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
-end