diff --git a/nlsr_sync.c b/nlsr_sync.c
index 86b26bf..764a139 100644
--- a/nlsr_sync.c
+++ b/nlsr_sync.c
@@ -31,7 +31,7 @@
 #include "utility.h"
 
 
-char *
+    char *
 hex_string(unsigned char *s, size_t l)
 {
     const char *hex_digits = "0123456789abcdef";
@@ -39,36 +39,36 @@
     int i;
     r = calloc(1, 1 + 2 * l);
     for (i = 0; i < l; i++) {
-        r[2*i] = hex_digits[(s[i]>>4) & 0xf];
-        r[1+2*i] = hex_digits[s[i] & 0xf];
+	r[2*i] = hex_digits[(s[i]>>4) & 0xf];
+	r[1+2*i] = hex_digits[s[i] & 0xf];
     }
     return(r);
 }
 
-int
+    int
 sync_cb(struct ccns_name_closure *nc,
-        struct ccn_charbuf *lhash,
-        struct ccn_charbuf *rhash,
-        struct ccn_charbuf *name)
+	struct ccn_charbuf *lhash,
+	struct ccn_charbuf *rhash,
+	struct ccn_charbuf *name)
 {
     char *hexL;
     char *hexR;
     int res;
     struct ccn_charbuf *uri = ccn_charbuf_create();
     if (lhash == NULL || lhash->length == 0) {
-        hexL = strdup("none");
+	hexL = strdup("none");
     } else
-        hexL = hex_string(lhash->buf, lhash->length);
+	hexL = hex_string(lhash->buf, lhash->length);
     if (rhash == NULL || rhash->length == 0) {
-        hexR = strdup("none");
+	hexR = strdup("none");
     } else
-        hexR = hex_string(rhash->buf, rhash->length);
+	hexR = hex_string(rhash->buf, rhash->length);
     if (name != NULL)
-        ccn_uri_append(uri, name->buf, name->length, 1);
+	ccn_uri_append(uri, name->buf, name->length, 1);
     else
-        ccn_charbuf_append_string(uri, "(null)");
+	ccn_charbuf_append_string(uri, "(null)");
 
-  
+
     if ( nlsr->debugging )
 	printf("Response from sync in the name: %s \n",ccn_charbuf_as_string(uri));	
 
@@ -78,489 +78,489 @@
     ccn_charbuf_destroy(&uri);
 
 
-	//--Doing our thing from here
- 	//struct ccn_indexbuf cid={0};
+    //--Doing our thing from here
+    //struct ccn_indexbuf cid={0};
 
-    	//struct ccn_indexbuf *components=&cid;
-	struct ccn_indexbuf *components=ccn_indexbuf_create();
-    	res=ccn_name_split (name, components);
-	if ( res < 0 )
-		return 0;
-    	//ccn_name_chop(name,components,-3);
-	//process_content_from_sync(name,components);
+    //struct ccn_indexbuf *components=&cid;
+    struct ccn_indexbuf *components=ccn_indexbuf_create();
+    res=ccn_name_split (name, components);
+    if ( res < 0 )
+	return 0;
+    //ccn_name_chop(name,components,-3);
+    //process_content_from_sync(name,components);
 
-	struct ccn_charbuf *content_name = ccn_charbuf_create();
-	ccn_name_init(content_name);
-	if (components->n < 2)
-		return 0;
-	res = ccn_name_append_components(content_name, name->buf, components->buf[0]
-										, components->buf[components->n - 1]);
+    struct ccn_charbuf *content_name = ccn_charbuf_create();
+    ccn_name_init(content_name);
+    if (components->n < 2)
+	return 0;
+    res = ccn_name_append_components(content_name, name->buf, components->buf[0]
+	    , components->buf[components->n - 1]);
 
-	if ( res < 0)
-		return 0;
+    if ( res < 0)
+	return 0;
 
 
-	// debugging purpose
-	struct ccn_charbuf *temp=ccn_charbuf_create();
-	ccn_uri_append(temp, content_name->buf, content_name->length, 0);
-	if ( nlsr->debugging )
-		printf("Name before chopping: %s \n",ccn_charbuf_as_string(temp));
-	ccn_charbuf_destroy(&temp);
+    // debugging purpose
+    struct ccn_charbuf *temp=ccn_charbuf_create();
+    ccn_uri_append(temp, content_name->buf, content_name->length, 0);
+    if ( nlsr->debugging )
+	printf("Name before chopping: %s \n",ccn_charbuf_as_string(temp));
+    ccn_charbuf_destroy(&temp);
 
-	//struct ccn_indexbuf cid1={0};
-    	//struct ccn_indexbuf *components1=&cid1;
-	struct ccn_indexbuf *components1=ccn_indexbuf_create();
-    	res=ccn_name_split (content_name, components1);
-	if ( res < 0)
-		return 0;		
+    //struct ccn_indexbuf cid1={0};
+    //struct ccn_indexbuf *components1=&cid1;
+    struct ccn_indexbuf *components1=ccn_indexbuf_create();
+    res=ccn_name_split (content_name, components1);
+    if ( res < 0)
+	return 0;		
 
-	if ( nlsr->debugging )
-		{
-			printf("Number of components in name = %d \n",res);
-			printf("Number of components in name as indexbuf->n = %d \n",
-														(int)components1->n);
-		}
-	ccn_name_chop(content_name,components1,-3);
-	if ( nlsr->debugging )
-		printf("Number of components in name as indexbuf->n after chopping= %d \n"
-															,(int)components1->n);	
+    if ( nlsr->debugging )
+    {
+	printf("Number of components in name = %d \n",res);
+	printf("Number of components in name as indexbuf->n = %d \n",
+		(int)components1->n);
+    }
+    ccn_name_chop(content_name,components1,-3);
+    if ( nlsr->debugging )
+	printf("Number of components in name as indexbuf->n after chopping= %d \n"
+		,(int)components1->n);	
 
-	//debugging purpose
-	struct ccn_charbuf *temp1=ccn_charbuf_create();
-	ccn_uri_append(temp1, content_name->buf, content_name->length, 0);
-	if ( nlsr->debugging )
-		printf("Name after chopping: %s \n",ccn_charbuf_as_string(temp1));
-	ccn_charbuf_destroy(&temp1);
+    //debugging purpose
+    struct ccn_charbuf *temp1=ccn_charbuf_create();
+    ccn_uri_append(temp1, content_name->buf, content_name->length, 0);
+    if ( nlsr->debugging )
+	printf("Name after chopping: %s \n",ccn_charbuf_as_string(temp1));
+    ccn_charbuf_destroy(&temp1);
 
-	process_content_from_sync(content_name,components1);
-	ccn_charbuf_destroy(&content_name);
-	ccn_indexbuf_destroy(&components);
-	ccn_indexbuf_destroy(&components1);
+    process_content_from_sync(content_name,components1);
+    ccn_charbuf_destroy(&content_name);
+    ccn_indexbuf_destroy(&components);
+    ccn_indexbuf_destroy(&components1);
 
-  return(0);
+    return(0);
 }
 
 
 
-void 
+    void 
 get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb, 
-							struct ccn_indexbuf *interest_comps, int offset)
+	struct ccn_indexbuf *interest_comps, int offset)
 {
 
-	
-	
-	int i;
-	int lsa_position=0;
-	int len=0;
 
-	
-	struct ccn_indexbuf cid={0};
-    	struct ccn_indexbuf *components=&cid;
-	struct ccn_charbuf *name=ccn_charbuf_create();
-	ccn_name_from_uri(name,nlsr->slice_prefix);
-    	ccn_name_split (name, components);
-	lsa_position=components->n-2;
 
-    	ccn_charbuf_destroy(&name);
-	
+    int i;
+    int lsa_position=0;
+    int len=0;
 
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	for(i=lsa_position+1+offset;i<interest_comps->n-1;i++)
-	{
-		ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1, 
-																	&comp_size);
-		len+=1;
-		len+=(int)comp_size;	
-	}
-	len++;
 
-	char *neighbor=(char *)malloc(len);
-	memset(neighbor,0,len);
+    struct ccn_indexbuf cid={0};
+    struct ccn_indexbuf *components=&cid;
+    struct ccn_charbuf *name=ccn_charbuf_create();
+    ccn_name_from_uri(name,nlsr->slice_prefix);
+    ccn_name_split (name, components);
+    lsa_position=components->n-2;
 
-	for(i=lsa_position+1+offset; i<interest_comps->n-1;i++)
-	{
-		ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1, 
-																	&comp_size);
-		memcpy(neighbor+strlen(neighbor),"/",1);
-		memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,
-												strlen((char *)comp_ptr1));
+    ccn_charbuf_destroy(&name);
 
-	}
 
-	name_part->name=(char *)malloc(strlen(neighbor)+1);
-	memset(name_part->name,0,strlen(neighbor)+1);
-	memcpy(name_part->name,neighbor,strlen(neighbor)+1);
-	name_part->length=strlen(neighbor)+1;
+    const unsigned char *comp_ptr1;
+    size_t comp_size;
+    for(i=lsa_position+1+offset;i<interest_comps->n-1;i++)
+    {
+	ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1, 
+		&comp_size);
+	len+=1;
+	len+=(int)comp_size;	
+    }
+    len++;
 
-	// Add 01/31/2013
-	free(neighbor);
+    char *neighbor=(char *)malloc(len);
+    memset(neighbor,0,len);
+
+    for(i=lsa_position+1+offset; i<interest_comps->n-1;i++)
+    {
+	ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1, 
+		&comp_size);
+	memcpy(neighbor+strlen(neighbor),"/",1);
+	memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,
+		strlen((char *)comp_ptr1));
+
+    }
+
+    name_part->name=(char *)malloc(strlen(neighbor)+1);
+    memset(name_part->name,0,strlen(neighbor)+1);
+    memcpy(name_part->name,neighbor,strlen(neighbor)+1);
+    name_part->length=strlen(neighbor)+1;
+
+    // Add 01/31/2013
+    free(neighbor);
 }
 
 
 
 
 
-void 
+    void 
 get_content_by_content_name(char *content_name, unsigned char **content_data)
 {
 
-	struct ccn_charbuf *name = NULL;
-	struct ccn_charbuf *templ = NULL;
-	struct ccn_charbuf *resultbuf = NULL;
-	struct ccn_parsed_ContentObject pcobuf = { 0 };
-	int res;
-	int allow_stale = 0;
-	int content_only = 1;
-	int scope = -1;
-	const unsigned char *ptr; 
-	size_t length;
-	int resolve_version = CCN_V_HIGHEST;
-	int timeout_ms = 3000;
-	const unsigned lifetime_default = CCN_INTEREST_LIFETIME_SEC << 12;
-	unsigned lifetime_l12 = lifetime_default;
-	int get_flags = 0;
+    struct ccn_charbuf *name = NULL;
+    struct ccn_charbuf *templ = NULL;
+    struct ccn_charbuf *resultbuf = NULL;
+    struct ccn_parsed_ContentObject pcobuf = { 0 };
+    int res;
+    int allow_stale = 0;
+    int content_only = 1;
+    int scope = -1;
+    const unsigned char *ptr; 
+    size_t length;
+    int resolve_version = CCN_V_HIGHEST;
+    int timeout_ms = 3000;
+    const unsigned lifetime_default = CCN_INTEREST_LIFETIME_SEC << 12;
+    unsigned lifetime_l12 = lifetime_default;
+    int get_flags = 0;
 
-	name = ccn_charbuf_create();
-	res = ccn_name_from_uri(name,content_name);
-	if (res < 0) {
-		fprintf(stderr, "Bad ccn URI: %s\n", content_name);
-		exit(1);
-	}
+    name = ccn_charbuf_create();
+    res = ccn_name_from_uri(name,content_name);
+    if (res < 0) {
+	fprintf(stderr, "Bad ccn URI: %s\n", content_name);
+	exit(1);
+    }
 
-	if (allow_stale || lifetime_l12 != lifetime_default || scope != -1) {
-		templ = ccn_charbuf_create();
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
-		ccn_charbuf_append_closer(templ); /* </Name> */
-		if (allow_stale) {
-			ccn_charbuf_append_tt(templ, CCN_DTAG_AnswerOriginKind, CCN_DTAG);
-			ccnb_append_number(templ,
-					CCN_AOK_DEFAULT | CCN_AOK_STALE);
-			ccn_charbuf_append_closer(templ); /* </AnswerOriginKind> */
-		}
-		if (scope != -1) {
-			ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
-		}
-		if (lifetime_l12 != lifetime_default) {
-			/*
-			 * Choose the interest lifetime so there are at least 3
-			 * expressions (in the unsatisfied case).
-			 */
-			unsigned char buf[3] = { 0 };
-			int i;
-			for (i = sizeof(buf) - 1; i >= 0; i--, lifetime_l12 >>= 8)
-				buf[i] = lifetime_l12 & 0xff;
-			ccnb_append_tagged_blob(templ, CCN_DTAG_InterestLifetime, buf, 
-																sizeof(buf));
-		}
-		ccn_charbuf_append_closer(templ); /* </Interest> */
+    if (allow_stale || lifetime_l12 != lifetime_default || scope != -1) {
+	templ = ccn_charbuf_create();
+	ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
+	ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
+	ccn_charbuf_append_closer(templ); /* </Name> */
+	if (allow_stale) {
+	    ccn_charbuf_append_tt(templ, CCN_DTAG_AnswerOriginKind, CCN_DTAG);
+	    ccnb_append_number(templ,
+		    CCN_AOK_DEFAULT | CCN_AOK_STALE);
+	    ccn_charbuf_append_closer(templ); /* </AnswerOriginKind> */
 	}
-	resultbuf = ccn_charbuf_create();
-	if (resolve_version != 0) {
-		res = ccn_resolve_version(nlsr->ccn, name, resolve_version, 500);
-		if (res >= 0) {
-			ccn_uri_append(resultbuf, name->buf, name->length, 1);
-			resultbuf->length = 0;
-		}
+	if (scope != -1) {
+	    ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
 	}
-	res = ccn_get(nlsr->ccn, name, templ, timeout_ms, resultbuf, &pcobuf, NULL, 
-																	get_flags);
+	if (lifetime_l12 != lifetime_default) {
+	    /*
+	     * Choose the interest lifetime so there are at least 3
+	     * expressions (in the unsatisfied case).
+	     */
+	    unsigned char buf[3] = { 0 };
+	    int i;
+	    for (i = sizeof(buf) - 1; i >= 0; i--, lifetime_l12 >>= 8)
+		buf[i] = lifetime_l12 & 0xff;
+	    ccnb_append_tagged_blob(templ, CCN_DTAG_InterestLifetime, buf, 
+		    sizeof(buf));
+	}
+	ccn_charbuf_append_closer(templ); /* </Interest> */
+    }
+    resultbuf = ccn_charbuf_create();
+    if (resolve_version != 0) {
+	res = ccn_resolve_version(nlsr->ccn, name, resolve_version, 500);
 	if (res >= 0) {
-		ptr = resultbuf->buf;
-		length = resultbuf->length;
-		if (content_only){
-			ccn_content_get_value(ptr, length, &pcobuf, &ptr, &length);
-			*content_data = (unsigned char *) calloc(length, sizeof(char *));
-			memcpy (*content_data, ptr, length);
-		}
+	    ccn_uri_append(resultbuf, name->buf, name->length, 1);
+	    resultbuf->length = 0;
 	}
-	ccn_charbuf_destroy(&resultbuf);
-	ccn_charbuf_destroy(&templ);
-	ccn_charbuf_destroy(&name);   
+    }
+    res = ccn_get(nlsr->ccn, name, templ, timeout_ms, resultbuf, &pcobuf, NULL, 
+	    get_flags);
+    if (res >= 0) {
+	ptr = resultbuf->buf;
+	length = resultbuf->length;
+	if (content_only){
+	    ccn_content_get_value(ptr, length, &pcobuf, &ptr, &length);
+	    *content_data = (unsigned char *) calloc(length, sizeof(char *));
+	    memcpy (*content_data, ptr, length);
+	}
+    }
+    ccn_charbuf_destroy(&resultbuf);
+    ccn_charbuf_destroy(&templ);
+    ccn_charbuf_destroy(&name);   
 }
 
-void 
+    void 
 process_incoming_sync_content_lsa( unsigned char *content_data)
 {
 
 
+    if ( nlsr->debugging )
+	printf("process_incoming_sync_content_lsa called \n");	
+
+    char *sep="|";
+    char *rem;
+    char *orig_router;
+    char *orl;
+    int orig_router_length;
+    char *lst;
+    int ls_type;
+    char *lsid;
+    long int ls_id;
+    char *isvld;
+    int isValid;
+    char *num_link;
+    int no_link;
+    char *np;
+    char *np_length;
+    int name_length;
+    char *data;
+    char *orig_time;
+
+
+    if ( nlsr->debugging )
+	printf("LSA Data \n");
+
+    if( strlen((char *)content_data ) > 0 )
+    {
+
+	orig_router=strtok_r((char *)content_data,sep,&rem);
+	orl=strtok_r(NULL,sep,&rem);
+	orig_router_length=atoi(orl);
+
 	if ( nlsr->debugging )
-		printf("process_incoming_sync_content_lsa called \n");	
-
-	char *sep="|";
-	char *rem;
-	char *orig_router;
-	char *orl;
-	int orig_router_length;
-	char *lst;
-	int ls_type;
-	char *lsid;
-	long int ls_id;
-	char *isvld;
-	int isValid;
-	char *num_link;
-	int no_link;
-	char *np;
-	char *np_length;
-	int name_length;
-	char *data;
-	char *orig_time;
-
-	
-	if ( nlsr->debugging )
-		printf("LSA Data \n");
-
-	if( strlen((char *)content_data ) > 0 )
 	{
-
-		orig_router=strtok_r((char *)content_data,sep,&rem);
-		orl=strtok_r(NULL,sep,&rem);
-		orig_router_length=atoi(orl);
-
-		if ( nlsr->debugging )
-		{
-			printf("	Orig Router Name  : %s\n",orig_router);
-			printf("	Orig Router Length: %d\n",orig_router_length);
-		}
-
-		lst=strtok_r(NULL,sep,&rem);		
-		ls_type=atoi(lst);
-
-		if ( nlsr->debugging )
-			printf("	LS Type  : %d\n",ls_type);
-
-		if ( ls_type == LS_TYPE_NAME )
-		{
-			lsid=strtok_r(NULL,sep,&rem);
-			ls_id=atoi(lsid);
-			orig_time=strtok_r(NULL,sep,&rem);
-			isvld=strtok_r(NULL,sep,&rem);
-			isValid=atoi(isvld);
-			np=strtok_r(NULL,sep,&rem);
-			np_length=strtok_r(NULL,sep,&rem);
-			name_length=atoi(np_length);
-			if ( nlsr->debugging )
-			{
-				printf("	LS ID  : %ld\n",ls_id);
-				printf("	isValid  : %d\n",isValid);
-				printf("	Name Prefix : %s\n",np);
-				printf("	Orig Time   : %s\n",orig_time);
-				printf("	Name Prefix length: %d\n",name_length);
-			}
-
-			build_and_install_others_name_lsa(orig_router,ls_type,ls_id,orig_time,isValid,np);
-
-			print_name_lsdb();
-
-		}
-		else if ( ls_type == LS_TYPE_ADJ )
-		{
-			orig_time=strtok_r(NULL,sep,&rem);
-			num_link=strtok_r(NULL,sep,&rem);
-			no_link=atoi(num_link);
-			data=rem;
-
-			if ( nlsr->debugging )
-			{
-				printf("	Orig Time   : %s\n",orig_time);
-				printf("	No Link  : %d\n",no_link);
-				printf("	Data  : %s\n",data);
-			}
-			build_and_install_others_adj_lsa(orig_router,ls_type,orig_time,no_link,data);
-		}
-		else if ( ls_type == LS_TYPE_COR )
-		{
-			orig_time=strtok_r(NULL,sep,&rem);
-			char *cor_r=strtok_r(NULL,sep,&rem);
-			char *cor_theta=strtok_r(NULL,sep,&rem);
-
-			double r, theta;
-			r=strtof(cor_r,NULL);
-			theta=strtof(cor_theta,NULL);
-
-			if ( nlsr->debugging )
-			{
-				printf("	Orig Time   : %s\n",orig_time);
-				printf("	Cor R	    : %f\n",r);
-				printf("	Cor Theta   : %f\n",theta);
-			}
-			build_and_install_others_cor_lsa(orig_router,ls_type,orig_time, (double)r, (double)theta);	
-		}
-		
+	    printf("	Orig Router Name  : %s\n",orig_router);
+	    printf("	Orig Router Length: %d\n",orig_router_length);
 	}
+
+	lst=strtok_r(NULL,sep,&rem);		
+	ls_type=atoi(lst);
+
+	if ( nlsr->debugging )
+	    printf("	LS Type  : %d\n",ls_type);
+
+	if ( ls_type == LS_TYPE_NAME )
+	{
+	    lsid=strtok_r(NULL,sep,&rem);
+	    ls_id=atoi(lsid);
+	    orig_time=strtok_r(NULL,sep,&rem);
+	    isvld=strtok_r(NULL,sep,&rem);
+	    isValid=atoi(isvld);
+	    np=strtok_r(NULL,sep,&rem);
+	    np_length=strtok_r(NULL,sep,&rem);
+	    name_length=atoi(np_length);
+	    if ( nlsr->debugging )
+	    {
+		printf("	LS ID  : %ld\n",ls_id);
+		printf("	isValid  : %d\n",isValid);
+		printf("	Name Prefix : %s\n",np);
+		printf("	Orig Time   : %s\n",orig_time);
+		printf("	Name Prefix length: %d\n",name_length);
+	    }
+
+	    build_and_install_others_name_lsa(orig_router,ls_type,ls_id,orig_time,isValid,np);
+
+	    print_name_lsdb();
+
+	}
+	else if ( ls_type == LS_TYPE_ADJ )
+	{
+	    orig_time=strtok_r(NULL,sep,&rem);
+	    num_link=strtok_r(NULL,sep,&rem);
+	    no_link=atoi(num_link);
+	    data=rem;
+
+	    if ( nlsr->debugging )
+	    {
+		printf("	Orig Time   : %s\n",orig_time);
+		printf("	No Link  : %d\n",no_link);
+		printf("	Data  : %s\n",data);
+	    }
+	    build_and_install_others_adj_lsa(orig_router,ls_type,orig_time,no_link,data);
+	}
+	else if ( ls_type == LS_TYPE_COR )
+	{
+	    orig_time=strtok_r(NULL,sep,&rem);
+	    char *cor_r=strtok_r(NULL,sep,&rem);
+	    char *cor_theta=strtok_r(NULL,sep,&rem);
+
+	    double r, theta;
+	    r=strtof(cor_r,NULL);
+	    theta=strtof(cor_theta,NULL);
+
+	    if ( nlsr->debugging )
+	    {
+		printf("	Orig Time   : %s\n",orig_time);
+		printf("	Cor R	    : %f\n",r);
+		printf("	Cor Theta   : %f\n",theta);
+	    }
+	    build_and_install_others_cor_lsa(orig_router,ls_type,orig_time, (double)r, (double)theta);	
+	}
+
+    }
 }
 
-void
+    void
 process_content_from_sync(struct ccn_charbuf *content_name, struct ccn_indexbuf *components)
 {
-	size_t comp_size;
-	char *lst;
-	char *lsid;
-	const unsigned char *second_last_comp;
-	const unsigned char *third_last_comp;
-	const unsigned char *origtime;
-	char *sep=".";
-	char *rem;
-	char *second_comp_type;
+    size_t comp_size;
+    char *lst;
+    char *lsid;
+    const unsigned char *second_last_comp;
+    const unsigned char *third_last_comp;
+    const unsigned char *origtime;
+    char *sep=".";
+    char *rem;
+    char *second_comp_type;
 
-	int ls_type;
-	long int ls_id=0;
+    int ls_type;
+    long int ls_id=0;
 
-	unsigned char *content_data = NULL;
+    unsigned char *content_data = NULL;
 
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
+    char *time_stamp=(char *)malloc(20);
+    memset(time_stamp,0,20);
+    get_current_timestamp_micro(time_stamp);
 
-	struct ccn_charbuf *uri = ccn_charbuf_create();
-	ccn_uri_append(uri, content_name->buf, content_name->length, 0);	
+    struct ccn_charbuf *uri = ccn_charbuf_create();
+    ccn_uri_append(uri, content_name->buf, content_name->length, 0);	
 
-	struct name_prefix *orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix));
-	
+    struct name_prefix *orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix));
 
 
-	ccn_name_comp_get(content_name->buf, components,components->n-1-2,&second_last_comp, &comp_size);
-	if (nlsr->debugging)
-		printf("2nd Last Component: %s \n",second_last_comp);
-	
-	second_comp_type=strtok_r((char *)second_last_comp,sep,&rem);		
-	if ( strcmp( second_comp_type, "lsId" ) == 0 )
-	{	
-		lsid=rem;
-		ls_id=atoi(rem);
-		ccn_name_comp_get(content_name->buf, components,components->n-2-2,&third_last_comp, &comp_size);
-		lst=strtok_r((char *)third_last_comp,sep,&rem);
-		lst=rem;
-		ls_type=atoi(lst);
-		ccn_name_comp_get(content_name->buf, components,components->n-2,&origtime, &comp_size);
-		ccn_name_chop(content_name,components,-3);
-		get_name_part(orig_router,content_name,components,0);
-	
-		if ( nlsr->debugging )
-			printf("Orig Router: %s Ls Type: %d Ls id: %ld Orig Time: %s\n",orig_router->name,ls_type,ls_id,origtime);
 
-		int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
+    ccn_name_comp_get(content_name->buf, components,components->n-1-2,&second_last_comp, &comp_size);
+    if (nlsr->debugging)
+	printf("2nd Last Component: %s \n",second_last_comp);
 
-		if ( (strcmp(orig_router->name,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp(orig_router->name,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) )
-		{
-			int is_new_name_lsa=check_is_new_name_lsa(orig_router->name,(char *)lst,(char *)lsid,(char *)origtime);
-			if ( is_new_name_lsa == 1 )
-			{
-				if ( nlsr->debugging )
-					printf("New NAME LSA.....\n");	
-				get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-				if ( nlsr->debugging )
-					printf("Content Data: %s \n",content_data);
-				process_incoming_sync_content_lsa(content_data);
-			}
-			else 
-			{
-				if ( nlsr->debugging )
-					printf("Name LSA / Newer Name LSA already xists in LSDB\n");
-				get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-				
-				if ( nlsr->debugging )
-					printf("Content Data: %s \n",content_data);
-			}
-		}
-		else 
-		{
-			if ( nlsr->debugging )
-				printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
-		}
-	}
-	else
+    second_comp_type=strtok_r((char *)second_last_comp,sep,&rem);		
+    if ( strcmp( second_comp_type, "lsId" ) == 0 )
+    {	
+	lsid=rem;
+	ls_id=atoi(rem);
+	ccn_name_comp_get(content_name->buf, components,components->n-2-2,&third_last_comp, &comp_size);
+	lst=strtok_r((char *)third_last_comp,sep,&rem);
+	lst=rem;
+	ls_type=atoi(lst);
+	ccn_name_comp_get(content_name->buf, components,components->n-2,&origtime, &comp_size);
+	ccn_name_chop(content_name,components,-3);
+	get_name_part(orig_router,content_name,components,0);
+
+	if ( nlsr->debugging )
+	    printf("Orig Router: %s Ls Type: %d Ls id: %ld Orig Time: %s\n",orig_router->name,ls_type,ls_id,origtime);
+
+	int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
+
+	if ( (strcmp(orig_router->name,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp(orig_router->name,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) )
 	{
-		ls_type=atoi(rem);
-		lst=rem;
-		if(ls_type == LS_TYPE_ADJ)
-		{
-			ccn_name_comp_get(content_name->buf, components,components->n-2,&origtime, &comp_size);
-			ccn_name_chop(content_name,components,-2);
-			get_name_part(orig_router,content_name,components,0);
-		
-			if ( nlsr->debugging )
-				printf("Orig Router: %s Ls Type: %d Orig Time: %s\n",orig_router->name,ls_type,origtime);		
+	    int is_new_name_lsa=check_is_new_name_lsa(orig_router->name,(char *)lst,(char *)lsid,(char *)origtime);
+	    if ( is_new_name_lsa == 1 )
+	    {
+		if ( nlsr->debugging )
+		    printf("New NAME LSA.....\n");	
+		get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
+		if ( nlsr->debugging )
+		    printf("Content Data: %s \n",content_data);
+		process_incoming_sync_content_lsa(content_data);
+	    }
+	    else 
+	    {
+		if ( nlsr->debugging )
+		    printf("Name LSA / Newer Name LSA already xists in LSDB\n");
+		get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
 
-			int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
-			if ( (strcmp(orig_router->name,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp(orig_router->name,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) )	
-			{
-				int is_new_adj_lsa=check_is_new_adj_lsa(orig_router->name,(char *)lst,(char *)origtime);
-				if ( is_new_adj_lsa == 1 )
-				{
-					if ( nlsr->debugging )
-						printf("New Adj LSA.....\n");	
-					get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-				
-					if ( nlsr->debugging )
-						printf("Content Data: %s \n",content_data);
-					process_incoming_sync_content_lsa(content_data);			
-				}
-				else
-				{
-					if ( nlsr->debugging )
-						printf("Adj LSA / Newer Adj LSA already exists in LSDB\n");
-					get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-					if ( nlsr->debugging )
-						printf("Content Data: %s \n",content_data);
-				}
-			}
-			else 
-			{
-				if ( nlsr->debugging )
-					printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
-			}
-		}
-		else if(ls_type == LS_TYPE_COR)
-		{
-			ccn_name_comp_get(content_name->buf, components,components->n-2,&origtime, &comp_size);
-			ccn_name_chop(content_name,components,-2);
-			get_name_part(orig_router,content_name,components,0);
-		
-			if ( nlsr->debugging )
-				printf("Orig Router: %s Ls Type: %d Orig Time: %s\n",orig_router->name,ls_type,origtime);
-
-			int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
-			if ( (strcmp(orig_router->name,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp(orig_router->name,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) )	
-			{
-				int is_new_cor_lsa=check_is_new_cor_lsa(orig_router->name,(char *)lst,(char *)origtime);
-				if ( is_new_cor_lsa == 1 )
-				{
-					if ( nlsr->debugging )
-						printf("New Cor LSA.....\n");	
-					get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-				
-					if ( nlsr->debugging )
-						printf("Content Data: %s \n",content_data);
-					process_incoming_sync_content_lsa(content_data);			
-				}
-				else
-				{
-					if ( nlsr->debugging )
-						printf("Cor LSA / Newer Cor LSA already exists in LSDB\n");
-					get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-					if ( nlsr->debugging )
-						printf("Content Data: %s \n",content_data);
-				}
-			}
-			else 
-			{	
-				if ( nlsr->debugging )
-					printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
-			}
-
-		}
+		if ( nlsr->debugging )
+		    printf("Content Data: %s \n",content_data);
+	    }
 	}
+	else 
+	{
+	    if ( nlsr->debugging )
+		printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
+	}
+    }
+    else
+    {
+	ls_type=atoi(rem);
+	lst=rem;
+	if(ls_type == LS_TYPE_ADJ)
+	{
+	    ccn_name_comp_get(content_name->buf, components,components->n-2,&origtime, &comp_size);
+	    ccn_name_chop(content_name,components,-2);
+	    get_name_part(orig_router,content_name,components,0);
 
-	free(orig_router->name);
-	free(orig_router);
-	ccn_charbuf_destroy(&uri);
-	//01/31/2013	
-	free(time_stamp);
+	    if ( nlsr->debugging )
+		printf("Orig Router: %s Ls Type: %d Orig Time: %s\n",orig_router->name,ls_type,origtime);		
+
+	    int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
+	    if ( (strcmp(orig_router->name,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp(orig_router->name,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) )	
+	    {
+		int is_new_adj_lsa=check_is_new_adj_lsa(orig_router->name,(char *)lst,(char *)origtime);
+		if ( is_new_adj_lsa == 1 )
+		{
+		    if ( nlsr->debugging )
+			printf("New Adj LSA.....\n");	
+		    get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
+
+		    if ( nlsr->debugging )
+			printf("Content Data: %s \n",content_data);
+		    process_incoming_sync_content_lsa(content_data);			
+		}
+		else
+		{
+		    if ( nlsr->debugging )
+			printf("Adj LSA / Newer Adj LSA already exists in LSDB\n");
+		    get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
+		    if ( nlsr->debugging )
+			printf("Content Data: %s \n",content_data);
+		}
+	    }
+	    else 
+	    {
+		if ( nlsr->debugging )
+		    printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
+	    }
+	}
+	else if(ls_type == LS_TYPE_COR)
+	{
+	    ccn_name_comp_get(content_name->buf, components,components->n-2,&origtime, &comp_size);
+	    ccn_name_chop(content_name,components,-2);
+	    get_name_part(orig_router,content_name,components,0);
+
+	    if ( nlsr->debugging )
+		printf("Orig Router: %s Ls Type: %d Orig Time: %s\n",orig_router->name,ls_type,origtime);
+
+	    int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
+	    if ( (strcmp(orig_router->name,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp(orig_router->name,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) )	
+	    {
+		int is_new_cor_lsa=check_is_new_cor_lsa(orig_router->name,(char *)lst,(char *)origtime);
+		if ( is_new_cor_lsa == 1 )
+		{
+		    if ( nlsr->debugging )
+			printf("New Cor LSA.....\n");	
+		    get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
+
+		    if ( nlsr->debugging )
+			printf("Content Data: %s \n",content_data);
+		    process_incoming_sync_content_lsa(content_data);			
+		}
+		else
+		{
+		    if ( nlsr->debugging )
+			printf("Cor LSA / Newer Cor LSA already exists in LSDB\n");
+		    get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
+		    if ( nlsr->debugging )
+			printf("Content Data: %s \n",content_data);
+		}
+	    }
+	    else 
+	    {	
+		if ( nlsr->debugging )
+		    printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
+	    }
+
+	}
+    }
+
+    free(orig_router->name);
+    free(orig_router);
+    ccn_charbuf_destroy(&uri);
+    //01/31/2013	
+    free(time_stamp);
 }
 
-int
+    int
 sync_monitor(char *topo_prefix, char *slice_prefix)
 {
 
@@ -572,13 +572,13 @@
     nlsr->slice = ccns_slice_create();
     ccn_charbuf_reset(prefix);
     ccn_charbuf_reset(topo);
- 
+
     ccn_charbuf_reset(prefix);
     ccn_name_from_uri(prefix, slice_prefix);
-            
+
     ccn_charbuf_reset(topo);
     ccn_name_from_uri(topo, topo_prefix);
-    
+
     ccns_slice_set_topo_prefix(nlsr->slice, topo, prefix);
     nlsr->closure->callback = &sync_cb;
     nlsr->ccns = ccns_open(nlsr->ccn, nlsr->slice, nlsr->closure, roothash, NULL);
@@ -587,10 +587,10 @@
     ccn_charbuf_destroy(&prefix);
     ccn_charbuf_destroy(&topo);
     ccn_charbuf_destroy(&roothash);
-	return 0;
+    return 0;
 }
 
-struct ccn_charbuf *
+    struct ccn_charbuf *
 make_template(int scope)
 {
     struct ccn_charbuf *templ = NULL;
@@ -599,30 +599,30 @@
     ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
     ccn_charbuf_append_closer(templ); /* </Name> */
     if (0 <= scope && scope <= 2)
-        ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
+	ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
     ccn_charbuf_append_closer(templ); /* </Interest> */
     return(templ);
 }
 
-int
+    int
 write_data_to_repo(char *data, char *name_prefix)
 {
-	if ( nlsr->debugging )
-	{
-		printf("write_data_to_repo called\n");
-		printf("Content Name: %s \n",name_prefix);
-		printf("Content Data: %s \n",data);
-	}
+    if ( nlsr->debugging )
+    {
+	printf("write_data_to_repo called\n");
+	printf("Content Name: %s \n",name_prefix);
+	printf("Content Data: %s \n",data);
+    }
 
-	struct ccn *temp_ccn;
-	temp_ccn=ccn_create();
-	int ccn_fd=ccn_connect(temp_ccn, NULL);
-	if(ccn_fd == -1)
-	{
-		fprintf(stderr,"Could not connect to ccnd for Data Writing\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Could not connect to ccnd for Data Writing\n");
-		return -1;
-	}
+    struct ccn *temp_ccn;
+    temp_ccn=ccn_create();
+    int ccn_fd=ccn_connect(temp_ccn, NULL);
+    if(ccn_fd == -1)
+    {
+	fprintf(stderr,"Could not connect to ccnd for Data Writing\n");
+	writeLogg(__FILE__,__FUNCTION__,__LINE__,"Could not connect to ccnd for Data Writing\n");
+	return -1;
+    }
     struct ccn_charbuf *name = NULL;
     struct ccn_seqwriter *w = NULL;
     int blocksize = 4096;
@@ -632,65 +632,65 @@
     int res;
     size_t blockread;
     struct ccn_charbuf *templ;
-    
+
     name = ccn_charbuf_create();
     res = ccn_name_from_uri(name, name_prefix);
     if (res < 0) {
-        fprintf(stderr, "bad CCN URI: %s\n",name_prefix);
+	fprintf(stderr, "bad CCN URI: %s\n",name_prefix);
 	return -1;
     }
-  
-    
+
+
     w = ccn_seqw_create(temp_ccn, name);
     if (w == NULL) {
-        fprintf(stderr, "ccn_seqw_create failed\n");
+	fprintf(stderr, "ccn_seqw_create failed\n");
 	return -1;
     }
     ccn_seqw_set_block_limits(w, blocksize, blocksize);
     if (freshness > -1)
-        ccn_seqw_set_freshness(w, freshness);
+	ccn_seqw_set_freshness(w, freshness);
     if (torepo) {
-        struct ccn_charbuf *name_v = ccn_charbuf_create();
-        ccn_seqw_get_name(w, name_v);
-        ccn_name_from_uri(name_v, "%C1.R.sw");
-        ccn_name_append_nonce(name_v);
-        templ = make_template(scope);
-        res = ccn_get(temp_ccn, name_v, templ, 60000, NULL, NULL, NULL, 0);
-        ccn_charbuf_destroy(&templ);
-        ccn_charbuf_destroy(&name_v);
-        if (res < 0) {
-            fprintf(stderr, "No response from repository\n");
+	struct ccn_charbuf *name_v = ccn_charbuf_create();
+	ccn_seqw_get_name(w, name_v);
+	ccn_name_from_uri(name_v, "%C1.R.sw");
+	ccn_name_append_nonce(name_v);
+	templ = make_template(scope);
+	res = ccn_get(temp_ccn, name_v, templ, 60000, NULL, NULL, NULL, 0);
+	ccn_charbuf_destroy(&templ);
+	ccn_charbuf_destroy(&name_v);
+	if (res < 0) {
+	    fprintf(stderr, "No response from repository\n");
 	    return -1;
-        }
+	}
     }
 
 
 
 
-	blockread = 0;
+    blockread = 0;
 
 
-	blockread=strlen(data);
+    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);
-           	}
-    	}
+    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);
+	}
+    }
 
     ccn_seqw_close(w);
     ccn_run(temp_ccn, 100);
     ccn_charbuf_destroy(&name);
     ccn_destroy(&temp_ccn);
 
-	return 0;
+    return 0;
 }
 
 
-int
+    int
 create_sync_slice(char *topo_prefix, char *slice_prefix)
 {
     int res;
@@ -701,31 +701,31 @@
     struct ccn_charbuf *clause = ccn_charbuf_create();
     struct ccn_charbuf *slice_name = ccn_charbuf_create();
     struct ccn_charbuf *slice_uri = ccn_charbuf_create();
-    
+
     if (prefix == NULL || topo == NULL || clause == NULL ||
-        slice_name == NULL || slice_uri == NULL) {
-        fprintf(stderr, "Unable to allocate required memory.\n");
+	    slice_name == NULL || slice_uri == NULL) {
+	fprintf(stderr, "Unable to allocate required memory.\n");
 	return -1;
     }
-    
-     handle = ccn_create();
-     res = ccn_connect(handle, NULL);
-     if (0 > res) {
-         fprintf(stderr, "Unable to connect to ccnd.\n");
-         return -1;
-     }    
+
+    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);
     ccn_name_from_uri(topo, topo_prefix);
     ccn_charbuf_reset(prefix);
     ccn_name_from_uri(prefix,slice_prefix );
     ccns_slice_set_topo_prefix(slice, topo, prefix);
- 
-  
+
+
     res = ccns_write_slice(handle, slice, slice_name);
- 
+
     //01/31/2013
     ccns_slice_destroy(&slice);
     ccn_destroy(&handle);
