Index: /issm/trunk-jpl/src/c/classes/DofIndexing.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/DofIndexing.cpp	(revision 13411)
+++ /issm/trunk-jpl/src/c/classes/DofIndexing.cpp	(revision 13412)
@@ -21,15 +21,15 @@
 DofIndexing::DofIndexing(){
 
-	this->gsize=UNDEF;
-	this->fsize=UNDEF;
-	this->ssize=UNDEF;
-	this->clone=0;
-	this->f_set=NULL;
-	this->s_set=NULL;
-	this->svalues=NULL;
-	this->doftype=NULL;
-	this->gdoflist=NULL;
-	this->fdoflist=NULL;
-	this->sdoflist=NULL;
+	this->gsize    = UNDEF;
+	this->fsize    = UNDEF;
+	this->ssize    = UNDEF;
+	this->clone    = false;
+	this->f_set    = NULL;
+	this->s_set    = NULL;
+	this->svalues  = NULL;
+	this->doftype  = NULL;
+	this->gdoflist = NULL;
+	this->fdoflist = NULL;
+	this->sdoflist = NULL;
 
 }
@@ -43,10 +43,8 @@
 DofIndexing::DofIndexing(DofIndexing* in){ //copy constructor
 
-	int i;
-	this->gsize=in->gsize;
-	this->fsize=in->fsize;
-	this->ssize=in->ssize;
-	
-	this->clone=in->clone;
+	this->gsize = in->gsize;
+	this->fsize = in->fsize;
+	this->ssize = in->ssize;
+	this->clone = in->clone;
 
 	if(this->gsize>0){
@@ -58,9 +56,9 @@
 	}
 	else{
-		this->f_set=NULL;
-		this->s_set=NULL;
-		this->svalues=NULL;
-		this->doftype=NULL;
-		this->gdoflist=NULL;
+		this->f_set    = NULL;
+		this->s_set    = NULL;
+		this->svalues  = NULL;
+		this->doftype  = NULL;
+		this->gdoflist = NULL;
 	}
 	if(this->fsize>0 && this->fsize!=UNDEF)this->fdoflist=xNew<int>(this->fsize); else this->fdoflist=NULL;
@@ -95,8 +93,6 @@
 void DofIndexing::Init(int in_gsize,int* in_doftype){
 
-	int i;
 	this->gsize=in_gsize;
-	
-	this->clone=0;
+	this->clone=false;
 
 	/*allocate: */
@@ -109,5 +105,5 @@
 	}
 
-	for (i=0;i<this->gsize;i++){
+	for(int i=0;i<this->gsize;i++){
 		/*assume dof is free, no constraints, no rigid body constraint: */
 		this->f_set[i]=true;
Index: /issm/trunk-jpl/src/c/classes/DofIndexing.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/DofIndexing.h	(revision 13411)
+++ /issm/trunk-jpl/src/c/classes/DofIndexing.h	(revision 13412)
@@ -18,5 +18,5 @@
 
 		/*partitioning: */
-		int     clone;   //this node is replicated from another one 
+		bool clone;   //this node is replicated from another one 
 
 		/*boundary conditions sets: */
Index: /issm/trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 13411)
+++ /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 13412)
@@ -228,17 +228,16 @@
 
 	extern int my_rank;
-	extern int num_procs;
 	
 	/*record descriptions; */
 	int record_enum;
 	int record_length;
-	int record_code; //1 to 7 number
+	int record_code;     //1 to 7 number
 
 	/*records: */
-	int  booleanint=0;
-	int  integer=0;
-	IssmPDouble scalar=0;
-	char* string=NULL;
-	int   string_size;
+	int          booleanint  = 0;
+	int          integer     = 0;
+	IssmPDouble  scalar      = 0;
+	char        *string      = NULL;
+	int          string_size;
 
 	/*Check that some fields have been allocated*/
@@ -458,6 +457,4 @@
 
 	extern int my_rank;
-	extern int num_procs;
-	
 
 	/*output: */
@@ -488,5 +485,4 @@
 
 	extern int my_rank;
-	extern int num_procs;
 
 	/*output: */
@@ -515,8 +511,5 @@
 void  IoModel::FetchData(IssmDouble* pscalar,int data_enum){
 
-
 	extern int my_rank;
-	extern int num_procs;
-	
 
 	/*output: */
@@ -546,6 +539,4 @@
 
 	extern int my_rank;
-	extern int num_procs;
-	
 
 	/*output: */
@@ -597,5 +588,4 @@
 
 	extern int my_rank;
-	extern int num_procs;
 	int i,j;
 
@@ -672,5 +662,4 @@
 
 	extern int my_rank;
-	extern int num_procs;
 
 	/*output: */
@@ -737,6 +726,4 @@
 
 	extern int my_rank;
-	extern int num_procs;
-	
 	int i;
 
@@ -809,5 +796,4 @@
 
 	extern int my_rank;
-	extern int num_procs;
 
 	/*output: */
@@ -898,10 +884,7 @@
 void  IoModel::FetchData(Option** poption,int index){
 
-	extern int my_rank;
-	extern int num_procs;
-
 	/*output: */
-	int     code;
-	char   *name        = NULL;
+	int   code;
+	char *name = NULL;
 
 	/*First get option name*/
@@ -1220,5 +1203,4 @@
 
 	extern int my_rank;
-	extern int num_procs;
 
 	int found=0;
@@ -1315,5 +1297,4 @@
 	#ifdef _HAVE_ADOLC_ //cannot come here unless you are running AD mode, from DeclaredIndependents:
 	extern int my_rank;
-	extern int num_procs;
 
 	/*output: */
Index: /issm/trunk-jpl/src/c/classes/objects/Node.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Node.cpp	(revision 13411)
+++ /issm/trunk-jpl/src/c/classes/objects/Node.cpp	(revision 13412)
@@ -872,5 +872,4 @@
 
 	int i;
-	extern int my_rank;
 	int dofcount;
 
@@ -881,5 +880,4 @@
 	if(setenum==SsetEnum) this->indexing.InitSet(setenum);
 	
-		
 	/*For clone nodfs, don't distribute dofs, we will get them from another cpu in UpdateCloneDofs!*/
 	if(indexing.clone){
@@ -888,5 +886,4 @@
 
 	/*This node should distribute dofs for setenum set (eg, f_set or s_set), go ahead: */
-
 	if(setenum==GsetEnum){
 		for(i=0;i<this->indexing.gsize;i++){
@@ -909,8 +906,6 @@
 	else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
 
-
 	/*Assign output pointers: */
 	*pdofcount=dofcount;
-
 }
 /*}}}*/
@@ -919,5 +914,4 @@
 	
 	int i;
-	extern int my_rank;
 	
 	if(indexing.clone){
@@ -943,14 +937,22 @@
 
 	int j;
-	extern int my_rank;
-	
+
 	/*Are we a clone? : */
-	if(indexing.clone)return;
+	if(indexing.clone) return;
 
 	/*Ok, we are not a clone, just plug our dofs into truedofs: */
-	if(setenum==GsetEnum)for(j=0;j<this->indexing.gsize;j++)  *(truedofs+ncols*sid+j)=indexing.gdoflist[j];
-	else if(setenum==FsetEnum)for(j=0;j<this->indexing.fsize;j++)  *(truedofs+ncols*sid+j)=indexing.fdoflist[j];
-	else if(setenum==SsetEnum)for(j=0;j<this->indexing.ssize;j++)  *(truedofs+ncols*sid+j)=indexing.sdoflist[j];
-	else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
+	switch(setenum){
+		case GsetEnum:
+			for(j=0;j<this->indexing.gsize;j++) truedofs[ncols*sid+j]=indexing.gdoflist[j];
+			break;
+		case FsetEnum:
+			for(j=0;j<this->indexing.fsize;j++) truedofs[ncols*sid+j]=indexing.fdoflist[j];
+			break;
+		case SsetEnum:
+			for(j=0;j<this->indexing.ssize;j++) truedofs[ncols*sid+j]=indexing.sdoflist[j];
+			break;
+		default:
+			_error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
+	}
 
 }
@@ -960,17 +962,23 @@
 
 	int j;
-	extern int my_rank;
-	
+
 	/*If we are not a clone, don't update, we already have dofs!: */
-	if(indexing.clone==0)return;
-
+	if(!indexing.clone)return;
 
 	/*Ok, we are a clone node, but we did not create the dofs for this node.
-	 *      * Therefore, our doflist is garbage right now. Go pick it up in the alltruedofs: */
-	if(setenum==GsetEnum)for(j=0;j<this->indexing.gsize;j++) indexing.gdoflist[j]=*(alltruedofs+ncols*sid+j);
-	else if(setenum==FsetEnum)for(j=0;j<this->indexing.fsize;j++) indexing.fdoflist[j]=*(alltruedofs+ncols*sid+j);
-	else if(setenum==SsetEnum)for(j=0;j<this->indexing.ssize;j++) indexing.sdoflist[j]=*(alltruedofs+ncols*sid+j);
-	else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
-
+	 *Therefore, our doflist is garbage right now. Go pick it up in the alltruedofs: */
+	switch(setenum){
+		case GsetEnum:
+			for(j=0;j<this->indexing.gsize;j++) indexing.gdoflist[j]=alltruedofs[ncols*sid+j];
+			break;
+		case FsetEnum:
+			for(j=0;j<this->indexing.fsize;j++) indexing.fdoflist[j]=alltruedofs[ncols*sid+j];
+			break;
+		case SsetEnum:
+			for(j=0;j<this->indexing.ssize;j++) indexing.sdoflist[j]=alltruedofs[ncols*sid+j];
+			break;
+		default:
+			_error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
+	}
 }
 /*}}}*/
@@ -981,12 +989,11 @@
 
 	if (minranks[sid]==my_rank){
-		indexing.clone=0;
+		indexing.clone=false;
 	}
 	else{
 		/*!there is a cpu with lower rank that has the same node, 
 		therefore, I am a clone*/
-		indexing.clone=1; 	
-	}
-
-}
-/*}}}*/
+		indexing.clone=true;	
+	}
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/c/io/PrintfFunction.cpp
===================================================================
--- /issm/trunk-jpl/src/c/io/PrintfFunction.cpp	(revision 13411)
+++ /issm/trunk-jpl/src/c/io/PrintfFunction.cpp	(revision 13412)
@@ -17,6 +17,4 @@
 	int         string_size;
 	extern int  my_rank;
-	extern int  num_procs;
-                                                                                                                                                                                                     
 	//variable list of arguments
 	va_list args;
Index: /issm/trunk-jpl/src/c/matlab/io/PrintfFunction.cpp
===================================================================
--- /issm/trunk-jpl/src/c/matlab/io/PrintfFunction.cpp	(revision 13411)
+++ /issm/trunk-jpl/src/c/matlab/io/PrintfFunction.cpp	(revision 13412)
@@ -19,6 +19,5 @@
 	int         string_size;
 	extern int  my_rank;
-	extern int  num_procs;
-                                                                                                                                                                                                     
+
 	//variable list of arguments
 	va_list args;
Index: /issm/trunk-jpl/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp	(revision 13411)
+++ /issm/trunk-jpl/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp	(revision 13412)
@@ -13,9 +13,4 @@
 void ConstraintsStatex(int* pconverged, int* pnum_unstable_constraints, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads,Materials* materials,  Parameters* parameters){
 
-	int i;
-
-	extern int num_procs;
-	extern int my_rank;
-	
 	/*output: */
 	int converged=0;
Index: /issm/trunk-jpl/src/c/modules/MassFluxx/MassFluxx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/MassFluxx/MassFluxx.cpp	(revision 13411)
+++ /issm/trunk-jpl/src/c/modules/MassFluxx/MassFluxx.cpp	(revision 13412)
@@ -12,26 +12,22 @@
 void MassFluxx(IssmDouble* pmass_flux, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool process_units){
 
-	int i,j;
-	extern int num_procs;
-	extern int my_rank;
-	
-	Element* element=NULL;
-	int element_id;
+	int      i,j;
+	Element *element    = NULL;
+	int      element_id;
 	
 	/*output: */
 	IssmDouble mass_flux=0;
 	IssmDouble all_mass_flux=0;
-
 	int  counter;
 
 	/*all segments: */
-	IssmDouble** array=NULL;
-	int      M;
-	int*     mdims_array=NULL;
-	int*     ndims_array=NULL;
+	IssmDouble **array       = NULL;
+	int          M;
+	int         *mdims_array = NULL;
+	int         *ndims_array = NULL;
 
 	/*our segments of interest: */
-	IssmDouble*  segments=NULL;
-	int      num_segments;
+	IssmDouble *segments     = NULL;
+	int         num_segments;
 
 	/*First, figure out which segment to compute our mass flux on. Start with retrieving qmu_mass_flux_segments: */
Index: /issm/trunk-jpl/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp	(revision 13411)
+++ /issm/trunk-jpl/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp	(revision 13412)
@@ -12,9 +12,4 @@
 
 void ResetConstraintsx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads,Materials* materials,  Parameters* parameters){
-
-	int i;
-
-	extern int num_procs;
-	extern int my_rank;
 
 	/*output: */
