How can I optimize this?

json tag @s add .this tellraw @s "" tellraw @s {"text":"---Player ID List-----"} execute as @a run tellraw @a[tag=.this] ["",{"score":{"name":"@s","objective":"playerid"},"color":"yellow"},{"text":" "},{"selector":"@s","color":"green"}] tellraw @s {"text":"--------------------"} tag @s remove .this This display's all online players into the chat with there respective ID's. Can this be optimized? Also I would like to have an option to display online, and offline players.
Continue to help post