added npc code