Sort and remove duplicates from npc table