Comments Added
diff --git a/nlsr_lsdb.c b/nlsr_lsdb.c
index d08cb69..36f2dbd 100644
--- a/nlsr_lsdb.c
+++ b/nlsr_lsdb.c
@@ -34,13 +34,8 @@
 void
 set_new_lsdb_version(void)
 {
-	
-	//char *time_stamp=get_current_timestamp_micro_v2();
 	free(nlsr->lsdb->lsdb_version);
 	nlsr->lsdb->lsdb_version=get_current_timestamp_micro_v2();
-	//nlsr->lsdb->lsdb_version=(char *)calloc(strlen(time_stamp)+1,sizeof(char));
-	//memcpy(nlsr->lsdb->lsdb_version,time_stamp,strlen(time_stamp)+1);
-	//free(time_stamp);
 }
 
 /**
@@ -116,10 +111,7 @@
 		printf("Cor LSA prefix for repo content:%s\n",key);	
 }
 
-/**
-* Build name lsa for all name prefixes in Name Prefix List (NPL). Intsall Name
-* LSA in Name LSDB for router itself.
-*/
+
 
 void
 destroy_name_lsa_component(struct nlsa * name_lsa)
@@ -194,6 +186,10 @@
 		free(cor_lsa);
 }
 
+/**
+* Build name lsa for all name prefixes in Name Prefix List (NPL). Intsall Name
+* LSA in Name LSDB for router itself.
+*/
 
 
 void 
@@ -255,6 +251,11 @@
 
 }
 
+/**
+* Build Name LSA for own router from name_prefix np and fill up the name_lsa
+*/
+
+
 void 
 build_name_lsa(struct nlsa *name_lsa, struct name_prefix *np)
 {
@@ -286,6 +287,10 @@
 
 }
 
+/**
+* install name lsa into lsdb
+*/
+
 void 
 install_name_lsa(struct nlsa *name_lsa)
 {
@@ -628,6 +633,10 @@
 		free(key);
 }
 
+/**
+* Write log for name LSA
+*/
+
 void 
 write_log_for_name_lsa(struct nlsa *name_lsa)
 {
@@ -697,9 +706,14 @@
 		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
 }
 
+/**
+* Build and install name LSA by the parameter provided
+*/
+
 
 void
-build_and_install_others_name_lsa(char *orig_router,int ls_type,long int ls_id,char *orig_time, int isValid,char *np)
+build_and_install_others_name_lsa(char *orig_router,int ls_type,long int ls_id,
+										char *orig_time, int isValid,char *np)
 {
 	if ( nlsr->debugging )
 		printf("build_and_install_others_name_lsa called \n");
@@ -717,8 +731,13 @@
 	
 }
 
+/**
+* Build name LSA by the parameter provided
+*/
+
 void
-build_others_name_lsa(struct nlsa *name_lsa, char *orig_router,int ls_type,long int ls_id,char *orig_time, int isValid,char *np)
+build_others_name_lsa(struct nlsa *name_lsa, char *orig_router,int ls_type,long 
+								int ls_id,char *orig_time, int isValid,char *np)
 {
 	if ( nlsr->debugging )
 		printf("build_others_name_lsa called\n");
@@ -1055,7 +1074,6 @@
 {
 	int i=0;
 	char *lsa_data=(char *)calloc(strlen(body)+1,sizeof(char));
-	//memset(	lsa_data,0,strlen(body)+1);
 	memcpy(lsa_data,body,strlen(body)+1);
 	char *sep="|";
 	char *rem;
@@ -2161,15 +2179,15 @@
 	if ( nlsr->debugging )
 		printf("Adj LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));
 
-	char *data;//=calloc(strlen(ccn_charbuf_as_string(lsa_data))+1,sizeof(char));
-	data=ccn_charbuf_as_string(lsa_data);
-	data[strlen(data)]='\0';
+	//char *data;
+	//data=ccn_charbuf_as_string(lsa_data);
+	//data[strlen(data)]='\0';
 
-	write_data_to_repo(data, repo_content_prefix);
+	//write_data_to_repo(data, repo_content_prefix);
 
+	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_content_prefix);
 
-	//ccn_charbuf_destroy(&lsa_data);
-	//free(data);
+	ccn_charbuf_destroy(&lsa_data);
 }
 
 void
@@ -2186,14 +2204,15 @@
 	if ( nlsr->debugging )
 		printf("Name LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));	
 
-	char *data;//=calloc(strlen(ccn_charbuf_as_string(lsa_data))+1,sizeof(char));
-	data=ccn_charbuf_as_string(lsa_data);
-	data[strlen(data)]='\0';
+	//char *data;
+	//data=ccn_charbuf_as_string(lsa_data);
+	//data[strlen(data)]='\0';
 
-	write_data_to_repo(data, repo_content_prefix);
+	//write_data_to_repo(data, repo_content_prefix);
 
-	//ccn_charbuf_destroy(&lsa_data);
-	//free(data);
+	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_content_prefix);
+
+	ccn_charbuf_destroy(&lsa_data);
 }
 
 
@@ -2540,11 +2559,13 @@
 	if ( nlsr->debugging )
 		printf("Cor LSA Repo Key: %s \n",repo_key);	
 
-	char *data;//=calloc(strlen(ccn_charbuf_as_string(lsa_data))+1,sizeof(char));
-	data=ccn_charbuf_as_string(lsa_data);
-	data[strlen(data)]='\0';
+	//char *data;
+	//data=ccn_charbuf_as_string(lsa_data);
+	//data[strlen(data)]='\0';
 
-	write_data_to_repo(data, repo_key);
+	//write_data_to_repo(data, repo_content_prefix);
+
+	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_key);
 
 
 	
@@ -2552,8 +2573,7 @@
 	free(lst);
 	free(key);
 	free(repo_key);
-	//free(data);
-	//ccn_charbuf_destroy(&lsa_data);
+	ccn_charbuf_destroy(&lsa_data);
 }
 
 void 
diff --git a/nlsr_sync.c b/nlsr_sync.c
index 53effdd..70e0b0d 100644
--- a/nlsr_sync.c
+++ b/nlsr_sync.c
@@ -47,6 +47,12 @@
 	return(r);
 }
 
+/**
+* call back function from sync. Receive notification of updates in sync.
+* This function calls process_content_from_sync to handle incoming content
+* from sync.
+*/
+
 int
 sync_cb(struct ccns_name_closure *nc,
 		struct ccn_charbuf *lhash,
@@ -119,6 +125,9 @@
 }
 
 
+/**
+* this function retrieve part of name from interest name and put it in name_part
+*/
 
 void
 get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb, 
@@ -159,7 +168,9 @@
 }
 
 
-
+/**
+* Get content value by content name and put the content value in content_data
+*/
 
 
 int 
@@ -267,6 +278,10 @@
 	return ret;   
 }
 
+/**
+* Handle incoming lsa content, Calls functions to install lsa into lsdb
+*/
+
 void 
 process_incoming_sync_content_lsa( unsigned char *content_data)
 {
@@ -381,6 +396,11 @@
 	}
 }
 
+/**
+* Check LSA whether its new. If new retrieve the LSA content and call 
+* process_incoming_sync_content_lsa with content_data
+*/
+
 void
 process_content_from_sync (struct ccn_charbuf *content_name, 
 								struct ccn_indexbuf *components)
@@ -619,6 +639,9 @@
 		}
 	}
 
+	if(content_data)
+		free(content_data);
+
 	if (orig_router->name)
 		free(orig_router->name);
 	if (orig_router)
@@ -628,7 +651,12 @@
 	free(time_stamp);
 }
 
-	int
+/**
+* This function performs same functionality as ccnsyncwatch
+*/
+
+
+int
 sync_monitor(char *topo_prefix, char *slice_prefix)
 {
 
@@ -669,7 +697,12 @@
 	return(templ);
 }
 
-	int
+/**
+* Write signed data to repo
+*/
+
+
+int
 write_data_to_repo(char *data, char *name_prefix)
 {
 
@@ -743,22 +776,18 @@
 										nlsr->router_name);	
 
 
-	//blockread = 0;
-	//blockread=strlen(data)+1;
 	blockread=resultbuf->length;
 
 	if (blockread > 0) {
-		//res = ccn_seqw_write(w, data, blockread);
 		res = ccn_seqw_write(w, resultbuf->buf, resultbuf->length);	
 		while (res == -1) {
-			ccn_run(temp_ccn,100);
-			//res = ccn_seqw_write(w, data, blockread);
+			ccn_run(temp_ccn,1);
 			res = ccn_seqw_write(w, resultbuf->buf, resultbuf->length);	
 		}
 	}
 
 	ccn_seqw_close(w);
-	ccn_run(temp_ccn, 100);
+	ccn_run(temp_ccn, 1);
 	ccn_charbuf_destroy(&name);
 	ccn_destroy(&temp_ccn);
 	ccn_charbuf_destroy(&resultbuf);
@@ -766,8 +795,14 @@
 	nlsr_unlock();
 	return 0;
 }
-	int
-	create_sync_slice(char *topo_prefix, char *slice_prefix)
+
+/**
+*	Create slice for sync/repo
+*/
+
+
+int
+create_sync_slice(char *topo_prefix, char *slice_prefix)
 {
 	int res;
 	struct ccn *handle;