Cleaning in NPT
diff --git a/macbook.conf b/macbook.conf
index 7310e35..ca312d5 100644
--- a/macbook.conf
+++ b/macbook.conf
@@ -3,7 +3,7 @@
 router-name /ndn/memphis.edu/netlab/macbook
 ccnneighbor /ndn/memphis.edu/cs/gemeni
 ccnneighbor /ndn/memphis.edu/cs/altair
-ccnneighbor /ndn/memphis.edu/cs/pollux 141.225.11.132
+#ccnneighbor /ndn/memphis.edu/cs/pollux 141.225.11.132
 ccnname /ndn/memphis.edu/macbook/patterson
 ccnname /ndn/memphis.edu/macbook/houston/
 #------lsdb-synch-interval-----
diff --git a/nlsr.c b/nlsr.c
index 11605a1..3f98b94 100644
--- a/nlsr.c
+++ b/nlsr.c
@@ -1088,10 +1088,8 @@
 	destroy_npl();
 	destroy_lsdb();	
 
-	//hashtb_destroy(&nlsr->lsdb->name_lsdb);
-	//hashtb_destroy(&nlsr->lsdb->adj_lsdb);
-	//hashtb_destroy(&nlsr->lsdb->cor_lsdb);
 
+	/*
 	int i, npt_element,rt_element;
 	struct npt_entry *ne;
 	struct hashtb_enumerator ee;
@@ -1108,7 +1106,8 @@
 
 	hashtb_end(e);
 	hashtb_destroy(&nlsr->npt);
-
+	*/
+	/*
 	struct routing_table_entry *rte;
 	hashtb_start(nlsr->routing_table, e);
 	rt_element=hashtb_n(nlsr->routing_table);
@@ -1120,6 +1119,7 @@
 	}	
 	hashtb_end(e);
 	hashtb_destroy(&nlsr->routing_table);
+	*/
 
 	if ( nlsr->ccns != NULL )
 		ccns_close(&nlsr->ccns, NULL, NULL);
diff --git a/nlsr_lsdb.c b/nlsr_lsdb.c
index 00de7b8..feffb18 100644
--- a/nlsr_lsdb.c
+++ b/nlsr_lsdb.c
@@ -69,6 +69,7 @@
 		printf("name LSA Key: %s\n", key);
 }
 
+
 /**
 * Make content name prefix for Name LSA to store in repo
 */
diff --git a/nlsr_npt.c b/nlsr_npt.c
index d42af67..81786af 100644
--- a/nlsr_npt.c
+++ b/nlsr_npt.c
@@ -35,7 +35,7 @@
 		return -1;
 	}
 
-	struct npt_entry *ne=(struct npt_entry*)malloc(sizeof(struct npt_entry ));
+	struct npt_entry *ne;//=(struct npt_entry*)calloc(1,sizeof(struct npt_entry ));
 	
 	int res,res_nle,res_fle;
 	struct hashtb_enumerator ee;
@@ -56,8 +56,8 @@
 	
 		
 
-		struct hashtb_param param_nle = {0};
-		ne->name_list= hashtb_create(sizeof(struct name_list_entry ), &param_nle);
+		//struct hashtb_param param_nle = {0};
+		ne->name_list= hashtb_create(sizeof(struct name_list_entry ),NULL);
 
 		struct hashtb_enumerator eenle;
     		struct hashtb_enumerator *enle = &eenle;
@@ -67,19 +67,19 @@
 
 		if(res_nle == HT_NEW_ENTRY )
 		{
-			struct name_list_entry *nle=(struct name_list_entry *)malloc(sizeof(struct name_list_entry));
+			struct name_list_entry *nle;//=(struct name_list_entry *)calloc(1,sizeof(struct name_list_entry));
 			nle=enle->data;
-			nle->name=(char *)malloc(strlen(name_prefix)+1);
-			memset(nle->name,0,strlen(name_prefix)+1);
-			memcpy(nle->name,name_prefix,strlen(name_prefix));
+			nle->name=(char *)calloc(strlen(name_prefix)+1,sizeof(char));
+			//memset(nle->name,0,strlen(name_prefix)+1);
+			memcpy(nle->name,name_prefix,strlen(name_prefix)+1);
 
 			
 
 		}
 		hashtb_end(enle);
 
-		struct hashtb_param param_fle = {0};
-		ne->face_list=hashtb_create(sizeof(struct face_list_entry), &param_fle);
+		//struct hashtb_param param_fle = {0};
+		ne->face_list=hashtb_create(sizeof(struct face_list_entry), NULL);
 
 		if ( num_face > 0 )
 		{
@@ -98,7 +98,7 @@
 				
 					if ( res_fle == HT_NEW_ENTRY )
 					{
-						struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
+						struct face_list_entry *fle;//=(struct face_list_entry *)calloc(1,sizeof(struct face_list_entry));
 						fle=ef->data;
 						fle->next_hop_face=face;
 						fle->route_cost=route_costs[i];
@@ -125,7 +125,7 @@
 
 		if(res_nle == HT_NEW_ENTRY )
 		{
-			struct name_list_entry *nle=(struct name_list_entry *)malloc(sizeof(struct name_list_entry));
+			struct name_list_entry *nle;//=(struct name_list_entry *)calloc(1,sizeof(struct name_list_entry));
 			nle=enle->data;
 			nle->name=(char *)malloc(strlen(name_prefix)+1);
 			memset(nle->name,0,strlen(name_prefix)+1);
@@ -154,7 +154,7 @@
 				
 					if ( res_fle == HT_NEW_ENTRY )
 					{
-						struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
+						struct face_list_entry *fle;//=(struct face_list_entry *)calloc(1,sizeof(struct face_list_entry));
 						fle=ef->data;
 						fle->next_hop_face=face;
 						fle->route_cost=route_costs[i];
@@ -999,29 +999,8 @@
 		
 		get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face);
 		sort_faces_by_distance(faces,route_costs,0,num_face);
-		
-		/*
-		first_face=num_face-1;		
-	
-		if ( nlsr->multi_path_face_num == 0 )
-		{
-			last_face=first_face;
-		}
-		else 
-		{
-			if ( num_face <= nlsr->multi_path_face_num)
-			{
-				last_face=0;
-			}
-			else if ( nlsr->multi_path_face_num == 0)
-			{
-				last_face=num_face-nlsr->multi_path_face_num;
-			}
-		}
-		*/
-
 		last_face=0;
-		if ( nlsr->max_faces_per_prefix == 0) // add all faces available in routing table
+		if ( nlsr->max_faces_per_prefix == 0)
 		{
 			first_face=num_face-1;
 		}
@@ -1114,3 +1093,71 @@
 	if ( nlsr->detailed_logging )
 		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
 }
+
+void
+destroy_name_list(void)
+{
+	
+}
+
+void
+destroy_face_list(void)
+{
+
+}
+
+void 
+destroy_npt(void)
+{
+
+
+	int i, npt_element;	
+	struct npt_entry *ne;
+
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee;
+    	
+    	hashtb_start(nlsr->npt, e);
+	npt_element=hashtb_n(nlsr->npt);
+
+	for(i=0;i<npt_element;i++)
+	{
+		ne=e->data;
+	
+		int j, nl_element,face_list_element;
+		struct name_list_entry *nle;		
+		struct hashtb_enumerator eenle;
+    		struct hashtb_enumerator *enle = &eenle;
+
+		hashtb_start(ne->name_list, enle);
+		nl_element=hashtb_n(ne->name_list);	
+
+		for (j=0;j<nl_element;j++)
+		{
+			nle=enle->data;
+			hashtb_next(enle);
+		}
+		hashtb_end(enle);
+
+		struct face_list_entry *fle;
+		struct hashtb_enumerator eef;
+    		struct hashtb_enumerator *ef = &eef;
+    	
+    		hashtb_start(ne->face_list, ef);
+		face_list_element=hashtb_n(ne->face_list);
+		
+		for(j=0;j<face_list_element;j++)
+		{
+			fle=ef->data;
+			hashtb_next(ef);	
+		}
+		
+		hashtb_end(ef);
+		
+			
+		hashtb_next(e);		
+	}
+
+	hashtb_end(e);
+}
+
diff --git a/nlsr_npt.h b/nlsr_npt.h
index d339ede..8d54828 100644
--- a/nlsr_npt.h
+++ b/nlsr_npt.h
@@ -8,7 +8,6 @@
 {
 	char *orig_router;
 	struct hashtb *name_list;
-	//int next_hop_face;
 	struct hashtb *face_list;
 };
 
diff --git a/nlsr_sync.c b/nlsr_sync.c
index 1226b79..672341a 100644
--- a/nlsr_sync.c
+++ b/nlsr_sync.c
@@ -640,10 +640,8 @@
 	blockread=strlen(data);
 
 	if (blockread > 0) {
-		ccn_run(temp_ccn, 100);
 		res = ccn_seqw_write(w, data, blockread);	
 		while (res == -1) {
-			ccn_run(temp_ccn, 100);
 			res = ccn_seqw_write(w, data, blockread);
 		}
 	}
@@ -651,6 +649,7 @@
 	ccn_seqw_close(w);
 	ccn_run(temp_ccn, 100);
 	ccn_charbuf_destroy(&name);
+	ccn_destroy(&temp_ccn);
 
 	return 0;
 }
@@ -660,7 +659,7 @@
 create_sync_slice(char *topo_prefix, char *slice_prefix)
 {
 	int res;
-	//struct ccn *handle; //obaid: probably we don't need it use the same handle i.e. nlsr->ccn
+	struct ccn *handle; //obaid: probably we don't need it use the same handle i.e. nlsr->ccn
 	struct ccns_slice *slice;
 	struct ccn_charbuf *prefix = ccn_charbuf_create();
 	struct ccn_charbuf *topo = ccn_charbuf_create();
@@ -674,13 +673,13 @@
 		return -1;
 	}
 
-	/*handle = ccn_create();
+	handle = ccn_create();
 	res = ccn_connect(handle, NULL);
 	if (0 > res) {
 		fprintf(stderr, "Unable to connect to ccnd.\n");
 		return -1;
 	}    
-*/
+
 	slice = ccns_slice_create();
 
 	ccn_charbuf_reset(topo);
@@ -690,12 +689,12 @@
 	ccns_slice_set_topo_prefix(slice, topo, prefix);
 
 
-	//res = ccns_write_slice(handle, slice, slice_name);
-	res = ccns_write_slice(nlsr->ccn, slice, slice_name);
+	res = ccns_write_slice(handle, slice, slice_name);
+	//res = ccns_write_slice(nlsr->ccn, slice, slice_name);
 
 	//01/31/2013
 	ccns_slice_destroy(&slice);
-	//ccn_destroy(&handle);
+	ccn_destroy(&handle);
 	ccn_charbuf_destroy(&prefix);
 	ccn_charbuf_destroy(&topo);
 	ccn_charbuf_destroy(&clause);