Villagers are excluded because their data was more than I wanted to deal with.
Be sure your players cannot set item lore, which can hack this. Add rename aliases on line 18 if players can rename. May need to replace "rename" with "/rename" if you don't have one of the addons.
(I'm unsure of what addons are needed for all of this.)