How do I refresh options panel

Let me start out by saying that I’m new to Lua and usually don’t know what I’m doing. I just poke around until I get something working.
I have been using evolve admin mod on my server and like the scoreboard a lot. However, it does not have mute buttons for players.
I decided to write a lua script to add a mute players options menu.
When you first join the server, the options panel fills up properly. When you click the mute icon, it does mute the player but the icon does not update. Also if new players join, they do not show up in the panel.

What I need help with is getting the panel to update / refresh / redraw when a user clicks the mute icon or the amount of players in the server changes.

Below is currently the code I have

Any help would be appreciated. Thanks.



if CLIENT then

surface.CreateFont( "NameDefault",
{
	font		= "Helvetica",
	size		= 20,
	weight		= 800
})

local plyrs = player.GetAll()

local function OptionsMenu(optionsPanel)
	local panelWide = optionsPanel:GetWide()
	optionsPanel:AddControl("Label", {Text = "Options Menu Player Mute"})
	optionsPanel:SetName("Options Menu Player Mute")
	--optionsPanel:SetSpacing(10)

	for id, pl in pairs( plyrs ) do


		pl.PlayerPanel = vgui.Create("DPanel")
			pl.PlayerPanel:SetWide(panelWide)
			--pl.PlayerPanel:SetTall(250)
			pl.PlayerPanel:SetVisible(true)

	  	pl.PlayerPanelWide = pl.PlayerPanel:GetWide()

			pl.NameLabel = vgui.Create( "DLabel", pl.PlayerPanel )
			pl.NameLabel:SetFont("NameDefault")
			pl.NameLabel:SetText(pl:Nick())
			pl.NameLabel:SetColor(Color(0,0,0,255))

			pl.Mute		= vgui.Create( "DImageButton", pl.PlayerPanel )
			pl.Mute:SetSize( 20, 20 )

			if ( pl.Muted == nil || pl.Muted != pl:IsMuted() ) then
				pl.Muted = pl:IsMuted()
			end

			pl.Mute.DoClick = function() 
			pl:SetMuted( !pl.Muted ) 
			if ( pl.Muted ) then
				pl.Mute:SetImage( "icon32/muted.png" )
			else
				pl.Mute:SetImage( "icon32/unmuted.png" )
			end
			end

			optionsPanel:AddItem(pl.PlayerPanel)
			pl.PlayerPanel:InvalidateLayout(true)
			pl.PlayerPanel.PerformLayout = function()
			pl.PlayerPanelWide = pl.PlayerPanel:GetWide()
			pl.NameLabel:SetWide(pl.PlayerPanelWide - 50)
			--pl.Mute:SetWide(pl.PlayerPanelWide - 12)
			--pl.NameLabel:SetTall(238)
			pl.Mute:SetPos(pl.PlayerPanelWide - 20 - 3,3)
			pl.NameLabel:SetPos(3,3)
		end
		end	
end
-- Actual options menu adding
local function MutePlayersOptionsMenu()
	spawnmenu.AddToolMenuOption("Options", "Mute Players", "MuteOptionsPlayers", "Players", "", "", OptionsMenu, {})
end

hook.Add("PopulateToolMenu", "MuteOptionsMenu", MutePlayersOptionsMenu)
end