Commented code to make it easier for others to understand npc update