local function createPanel()
    local LAM = LibStub("LibAddonMenu-2.0")
    local menuData = {}
    LAM:RegisterAddonPanel("LAddMin_UI", {
        type = "panel",
        name = "LAddMin",
        displayName = "|cFFFFB0LAddMin",
        author = "|c00C000Garkin|r and Sasky",
        version = "0.1",
    })
    LAM:RegisterOptionControls("LAddMin_UI", menuData)

    table.insert(menuData,{
        type = "description",
        title = "|cFF0000WARNING|r: Using this on addons can break them.",
        text = "If you have an error after enabling an addon, please disable it.\n" ..
                "If an addon you check here has an issue, disable the conversion here before filing a bug report."
    })

    table.insert(menuData,{
        type = "header",
        name = "LAM 1.0 Panels"
    })

    table.insert(menuData,{
        type = "description",
        text = "ON to enable LAM2 conversion"
    })

    --Sort into known working (good), known broken (bad), and unknown (ugly)
    --(Couldn't resist... ~Sasky)
    local good, ugly, bad = {}, {}, {}
    for k,_ in pairs(LAddMinUpconvertSettings.cfg) do
        local checkbox = {
            type = "checkbox",
            name = k,
            getFunc = function() return LAddMinUpconvertSettings.cfg[k] end,
            setFunc = function(val) LAddMinUpconvertSettings.cfg[k] = val end
        }

        if LAddMinCompatability[k] == nil then
            table.insert(ugly, checkbox)
        else
            if LAddMinCompatability[k] then
                table.insert(good, checkbox)
            else
                checkbox.warning = "Enabling this could cause " .. k .. " to stop working."
                table.insert(bad, checkbox)
            end
        end
    end

    local function checkboxSort(l,r)
        return l.name < r.name
    end

    table.sort(good, checkboxSort)
    table.sort(bad, checkboxSort)
    table.sort(ugly, checkboxSort)

    if #good > 0 then
        table.insert(menuData,{
            type = "submenu",
            name = "|c00FF00Working addons",
            tooltip = "These menus convert with no issues.",
            controls = good
        })
    end

    if #ugly > 0 then
        table.insert(menuData,{
            type = "submenu",
            name = "|cFFFF00Unknown addons",
            tooltip = "We haven't tested if these menus work.",
            controls = ugly
        })
    end

    if #bad > 0 then
        table.insert(menuData,{
            type = "submenu",
            name = "|cFF0000Not convertible addons",
            tooltip = "These menus have known issues up to the addon not working.",
            controls = bad
        })
    end

    EVENT_MANAGER:UnregisterForEvent("LAddMinUI", EVENT_PLAYER_ACTIVATED)
end

EVENT_MANAGER:RegisterForEvent("LAddMinUI", EVENT_PLAYER_ACTIVATED, createPanel)