Index: /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
===================================================================
--- /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 10363)
+++ /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 10364)
@@ -27,9 +27,9 @@
 
 	if(migration_style==SoftMigrationEnum){
-		/*Create flag for nodes above the hydrostatic equilibrium: */
+		/*Create flag for grounded vertices above the hydrostatic equilibrium: */
 		vertices_potentially_ungrounding=PotentialSheetUngrounding(elements,vertices,parameters);
 
 		/*propagate ice shelf into connex areas of the ice sheet that potentially want to unground: */
-		vertices_ungrounding=PropagateShelfIntoConnexIceSheet(elements,nodes,parameters,vertices_potentially_ungrounding);
+		vertices_ungrounding=PropagateShelfIntoConnexIceSheet(elements,nodes,vertices,parameters,vertices_potentially_ungrounding);
 	}
 
Index: /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationxLocal.h
===================================================================
--- /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationxLocal.h	(revision 10363)
+++ /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationxLocal.h	(revision 10364)
@@ -12,10 +12,10 @@
 
 /* local prototypes: */
-double*    PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters);
-double*    PropagateShelfIntoConnexIceSheet(Elements* elements,Nodes* nodes,Parameters* parameters,double* vertices_potentially_ungrounding);
 bool*      CreateElementOnGroundingline(Elements* elements,double* element_on_iceshelf);
 double*    CreateElementOnIceShelf(Elements* elements);
-double*    CreateElementTouchingIceShelf(Elements* elements,Vec vec_nodes_on_iceshelf);
-Vec        CreateNodesOnIceShelf(Nodes* nodes,int analysis_type);
+double*    CreateElementTouchingIceShelf(Elements* elements,double* nodes_on_iceshelf);
+Vec        CreateNodesOnIceShelf(Nodes* nodes,Vertices* vertices,int analysis_type);
+double*    PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters);
+double*    PropagateShelfIntoConnexIceSheet(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding);
 
 int        UpdateShelfStatus(Elements* elements,Nodes* nodes,Parameters* parameters,double* element_touching_iceshelf);
Index: /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationxUtils.cpp
===================================================================
--- /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationxUtils.cpp	(revision 10363)
+++ /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationxUtils.cpp	(revision 10364)
@@ -75,15 +75,11 @@
 /*}}}*/
 /*FUNCTION CreateElementTouchingIceShelf {{{1*/
-double*    CreateElementTouchingIceShelf(Elements* elements,Vec vec_nodes_on_iceshelf){ 
+double*    CreateElementTouchingIceShelf(Elements* elements,double* nodes_on_iceshelf){ 
 
 	int      i;
-	double  *nodes_on_iceshelf             = NULL;
 	double  *element_touching_iceshelf     = NULL;
 	Element *element                       = NULL;
 	Vec      vec_element_touching_iceshelf = NULL;
 
-	/*serialize: */
-	VecToMPISerial(&nodes_on_iceshelf,vec_nodes_on_iceshelf);
-
 	/*Create  vector holding  all the elements IsFloating flags: */
 	vec_element_touching_iceshelf=NewVec(elements->NumberOfElements(),true);
@@ -104,5 +100,4 @@
 	/*free ressouces: */
 	VecFree(&vec_element_touching_iceshelf);
-	xfree((void**)&nodes_on_iceshelf);
 
 	return element_touching_iceshelf;
@@ -110,13 +105,13 @@
 /*}}}*/
 /*FUNCTION CreateNodesOnIceShelf {{{1*/
-Vec CreateNodesOnIceShelf(Nodes* nodes,int configuration_type){ 
-
-	int     i,numnods;
+Vec CreateNodesOnIceShelf(Nodes* nodes,Vertices* vertices,int configuration_type){ 
+
+	int     i,numberofvertices;
 	Vec     nodes_on_iceshelf = NULL;
 	Node*   node              = NULL;
 
 	/*First, initialize nodes_on_iceshelf, which will track which nodes have changed status: */
-	numnods=nodes->NumberOfNodes(configuration_type);
-	nodes_on_iceshelf=NewVec(numnods);
+	numberofvertices=vertices->NumberOfVertices();
+	nodes_on_iceshelf=NewVec(numberofvertices);
 
 	/*Loop through nodes, and fill nodes_on_iceshelf: */
@@ -168,5 +163,5 @@
 /*}}}*/
 /*FUNCTION PropagateShelfIntoConnexIceSheet {{{1*/
-double*    PropagateShelfIntoConnexIceSheet(Elements* elements,Nodes* nodes,Parameters* parameters,double* vertices_potentially_ungrounding){ 
+double*    PropagateShelfIntoConnexIceSheet(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding){ 
 
 	int      i,analysis_type;
@@ -180,6 +175,7 @@
 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
 
-	/*recover vec_nodes_on_iceshelf: */
-	vec_nodes_on_iceshelf=CreateNodesOnIceShelf(nodes,analysis_type);
+	/*recover vec_nodes_on_iceshelf and serialize: */
+	vec_nodes_on_iceshelf=CreateNodesOnIceShelf(nodes,vertices,analysis_type);
+	VecToMPISerial(&nodes_on_iceshelf,vec_nodes_on_iceshelf);
 
 	nflipped=1; //bootstrap
@@ -187,14 +183,8 @@
 		
 		/*get a list of potential elements that have nodes on ice shelf: */
-		elements_touching_iceshelf=CreateElementTouchingIceShelf(elements,vec_nodes_on_iceshelf);
-
-		/*now,  go through elements_touching_iceshelf, and if they have nodes inside potential_sheet_ungrounding, 
-		 * flag it: */
+		elements_touching_iceshelf=CreateElementTouchingIceShelf(elements,nodes_on_iceshelf);
+
+		/*Go through elements_touching_iceshelf, and flag their nodes that can unground inside potential_sheet_ungrounding*/
 		local_nflipped=0;
-
-		/*serialize vec_nodes_on_iceshelf, needed by element's UpdatePotentialSheetUngrounding routine, to figure out if 
-		 * nodes have flipped from grounded to ungrounded: */
-		VecToMPISerial(&nodes_on_iceshelf,vec_nodes_on_iceshelf);
-
 		for(i=0;i<elements->Size();i++){
 			element=(Element*)elements->GetObjectByOffset(i);
@@ -208,14 +198,12 @@
 
 		/*Avoid leaks: */
+		xfree((void**)&elements_touching_iceshelf);
 		xfree((void**)&nodes_on_iceshelf);
-		xfree((void**)&elements_touching_iceshelf);
-
-		/*Assemble:*/
+
+		/*Assemble and serialize:*/
 		VecAssemblyBegin(vec_nodes_on_iceshelf);
 		VecAssemblyEnd(vec_nodes_on_iceshelf);
-	}
-
-	/*Serialize: */
-	VecToMPISerial(&nodes_on_iceshelf,vec_nodes_on_iceshelf);
+		VecToMPISerial(&nodes_on_iceshelf,vec_nodes_on_iceshelf); 
+	}
 
 	/*Free ressources:*/
