Add NPCLib; Make persistance more efficent; Refactored code