Index: /issm/trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 25826)
+++ /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 25827)
@@ -3814,5 +3814,5 @@
 
 	/*Get vertices coordinates*/
-	VertexCoordinatesx(&x,&y,&z,NULL,femmodel_vertices,false) ;
+	VertexCoordinatesx(&x,&y,&z,femmodel_vertices,false) ;
 
 	/*Get element vertices*/
@@ -4971,5 +4971,5 @@
 
 	/*recover lat,long and radius vectors from vertices: */
-	VertexCoordinatesx(&latitude,&longitude,&radius,NULL,this->vertices,spherical);
+	VertexCoordinatesx(&latitude,&longitude,&radius,this->vertices,spherical);
 
 	/* Green's function (1+k_2-h_2/g): checked against Glenn Milne's thesis Chapter 3 (eqs: 3.3-4, 3.10-11)
Index: /issm/trunk-jpl/src/c/classes/Vertex.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Vertex.cpp	(revision 25826)
+++ /issm/trunk-jpl/src/c/classes/Vertex.cpp	(revision 25827)
@@ -205,5 +205,5 @@
 }
 /*}}}*/
-void       Vertex::VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Vector<IssmDouble>* vrank,bool spherical){/*{{{*/
+void       Vertex::VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,bool spherical){/*{{{*/
 
 	if(this->clone==true) return;
@@ -219,9 +219,4 @@
 		vz->SetValue(this->sid,this->R,INS_VAL);
 	}
-	if(vrank){
-		int rank=IssmComm::GetRank();
-		vrank->SetValue(this->sid,rank,INS_VAL);
-	}
-
 	return;
 }
Index: /issm/trunk-jpl/src/c/classes/Vertex.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Vertex.h	(revision 25826)
+++ /issm/trunk-jpl/src/c/classes/Vertex.h	(revision 25827)
@@ -61,5 +61,5 @@
 		int        Sid(void); 
 		void       UpdatePosition(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed);
-		void       VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Vector<IssmDouble>* vrank,bool spherical=false);
+		void       VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,bool spherical=false);
 };
 
Index: /issm/trunk-jpl/src/c/cores/esa_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/esa_core.cpp	(revision 25826)
+++ /issm/trunk-jpl/src/c/cores/esa_core.cpp	(revision 25827)
@@ -44,6 +44,6 @@
 
 	/* recover coordinates of vertices: */
-	VertexCoordinatesx(&latitude,&longitude,&radius,NULL,femmodel->vertices,spherical); 
-	VertexCoordinatesx(&xx,&yy,&zz,NULL,femmodel->vertices); 
+	VertexCoordinatesx(&latitude,&longitude,&radius,femmodel->vertices,spherical); 
+	VertexCoordinatesx(&xx,&yy,&zz,femmodel->vertices); 
 
 	/*Figure out size of g-set deflection vector and allocate solution vector: */
Index: /issm/trunk-jpl/src/c/cores/gia_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/gia_core.cpp	(revision 25826)
+++ /issm/trunk-jpl/src/c/cores/gia_core.cpp	(revision 25827)
@@ -45,5 +45,5 @@
 
 		/*first, recover x and y vectors from vertices: */
-		VertexCoordinatesx(&x,&y,NULL,NULL,femmodel->vertices); //no need for z coordinate
+		VertexCoordinatesx(&x,&y,NULL,femmodel->vertices); //no need for z coordinate
 
 		/*call the main module: */
Index: /issm/trunk-jpl/src/c/cores/sealevelchange_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/sealevelchange_core.cpp	(revision 25826)
+++ /issm/trunk-jpl/src/c/cores/sealevelchange_core.cpp	(revision 25827)
@@ -392,6 +392,6 @@
 
 	/*first, recover lat,long and radius vectors from vertices: */
-	VertexCoordinatesx(&latitude,&longitude,&radius,NULL,femmodel->vertices,spherical); 
-	if(horiz) VertexCoordinatesx(&xx,&yy,&zz,NULL,femmodel->vertices); 
+	VertexCoordinatesx(&latitude,&longitude,&radius,femmodel->vertices,spherical); 
+	if(horiz) VertexCoordinatesx(&xx,&yy,&zz,femmodel->vertices); 
 
 
@@ -659,6 +659,6 @@
 
 	/*retrieve geometric information: */
-	VertexCoordinatesx(&latitude,&longitude,&radius,NULL,femmodel->vertices,spherical); 
-	VertexCoordinatesx(&xx,&yy,&zz,NULL,femmodel->vertices); 
+	VertexCoordinatesx(&latitude,&longitude,&radius,femmodel->vertices,spherical); 
+	VertexCoordinatesx(&xx,&yy,&zz,femmodel->vertices); 
 
 	/*call the elastic main modlule:*/ 
Index: /issm/trunk-jpl/src/c/main/esmfbinders.cpp
===================================================================
--- /issm/trunk-jpl/src/c/main/esmfbinders.cpp	(revision 25826)
+++ /issm/trunk-jpl/src/c/main/esmfbinders.cpp	(revision 25827)
@@ -6,8 +6,7 @@
 #include <ESMC.h>
 
-/*GCM specific declarations:*/
+/*GEOS 5 specific declarations:*/
 const int GCMForcingNumTerms = 1;
 const int GCMForcingTerms[GCMForcingNumTerms]= { SMBgcmEnum}; 
-
 const int ISSMOutputNumTerms = 1;
 const int ISSMOutputTerms[ISSMOutputNumTerms]= { SurfaceEnum };
@@ -159,4 +158,5 @@
       /*Intermediary*/
 		int rc;
+      int rank = IssmComm::GetRank();
 
 		/*Initialize femmodel from arguments provided command line: */
@@ -165,6 +165,6 @@
 		/*Initialize ESMC Mesh*/
 		int pdim;        /*parametric dimension is the same as the domain dimensions */
-		int sdim = 3;    /*coordinates of each vertex is always 3                    */
-		ESMC_CoordSys_Flag coordsys = ESMC_COORDSYS_CART; /*Cartesian coordinate system by default                    */
+		int sdim = 3;    /*coordinates of each vertex is always 2  (just x,y for now) */
+		ESMC_CoordSys_Flag coordsys = ESMC_COORDSYS_CART; /*Cartesian coordinate system by default */
 		femmodel->parameters->FindParam(&pdim,DomainDimensionEnum);
 		ESMC_Mesh mesh = ESMC_MeshCreate(pdim,sdim,&coordsys,&rc);
@@ -172,46 +172,39 @@
 
 		/*How to install ESMG with lib/libesmf.so
-		 * what is a PET?
-		 * should all of these arrays be specific to an MPI? or do all vectors need to be serialized
 		 * do indices need to be 1 based?
-		 * do we need ElementMask, ElementArea or Element Coords?*/
+		 * ESMF installation, how can we get everything in /lib
+		 * What do we do with vertices at the boundary, declare twice?
+		 * Do we need a restart file or save femmodel somewhere?*/
 
 		/*Add nodes (which are ISSM Vertices)*/
-		int numnodes = femmodel->vertices->NumberOfVertices();
-
-		IssmDouble* x=NULL;
-		IssmDouble* y=NULL;
-		IssmDouble* z=NULL;
-		int* nodeOwner=NULL;
-		VertexCoordinatesx(&x,&y,&z,&nodeOwner,femmodel->vertices);
-
-		int* nodeId = xNew<int>(numnodes);
-		IssmDouble* nodeCoord = xNew<IssmDouble>(sdim*numnodes);
-		for(int i=0;i<numnodes;i++){
-			nodeId[i] = i;
-			nodeCoord[sdim*i+0] = x[i];
-			nodeCoord[sdim*i+1] = y[i];
-			nodeCoord[sdim*i+2] = z[i];
-		}
-		xDelete<IssmDouble>(x);
-		xDelete<IssmDouble>(y);
-		xDelete<IssmDouble>(z);
-
+		int numnodes = femmodel->vertices->Size();
+		int        *nodeId    = xNew<int>(numnodes);
+		int        *nodeOwner = xNew<int>(numnodes);
+		IssmDouble *nodeCoord = xNew<IssmDouble>(sdim*numnodes);
+		for (int i=0;i<femmodel->elements->Size();i++){
+			Vertex* vertex = xDynamicCast<Vertex*>(femmodel->vertices->GetObjectByOffset(i));
+			nodeId[i]           = vertex->Sid()+1;
+         nodeOwner[i]        = rank;
+			nodeCoord[sdim*i+0] = vertex->x;
+			nodeCoord[sdim*i+1] = vertex->y;
+		}
 		rc = ESMC_MeshAddNodes(mesh,numnodes,nodeId,nodeCoord,nodeOwner);
 		if(rc!=ESMF_SUCCESS) _error_("could not add nodes to EMSC_Mesh");
-
+		xDelete<int>(nodeId);
 		xDelete<int>(nodeOwner);
-		xDelete<int>(nodeId);
 		xDelete<IssmDouble>(nodeCoord);
 
 		/*Add Elements (Assume triangles only for now)*/
-		int numelements = femmodel->elements->NumberOfElements();
+		int numelements = femmodel->elements->Size();
 		int* elemId   = xNew<int>(numelements);
 		int* elemType = xNew<int>(numelements);
 		int* elemConn = xNew<int>(numelements*3); /*Assuming triangles*/
-		for(int i=0;i<numelements;i++){
-			_error_("STOP");
-			elemId[i] = i;
+		for(int i=0;i<femmodel->elements->Size();i++){
+			Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
+			elemId[i]   = element->Sid()+1;
 			elemType[i] = ESMC_MESHELEMTYPE_TRI; /*Assuming triangles*/
+         elemConn[i*3+0] = element->vertices[0]->Lid()+1;
+         elemConn[i*3+1] = element->vertices[1]->Lid()+1;
+         elemConn[i*3+2] = element->vertices[2]->Lid()+1;
 		}
 		rc = ESMC_MeshAddElements(mesh,numelements,elemId,elemType,elemConn,NULL,NULL,NULL);
@@ -220,7 +213,10 @@
 		xDelete<int>(elemConn);
 
-		/*Some specific code here for the binding: */
-		_error_("not coded yet, will depend on what FISOC provides");
-		//femmodel->parameters->SetParam(SMBgcmEnum,SmbEnum); /*bypass SMB model, will be provided by GCM*/
+		/*DO we need to create fields here? https://earthsystemmodeling.org/docs/nightly/develop/ESMC_crefdoc/node5.html#SECTION05024400000000000000*/
+		//ESMC_InterArrayInt *gridToFieldMap,       // in
+		//ESMC_InterArrayInt *ungriddedLBound,      // in
+		//ESMC_InterArrayInt *ungriddedUBound,      // in
+		//ESMC_Field esmf_shelfbase = ESMC_FieldCreateMeshTypeKind(mesh,ESMC_TYPEKIND_R8,???,gridToFieldMap,ungriddedLBound,ungriddedUBound,"ShelfTopography",&rc);
+		if(rc!=ESMF_SUCCESS) _error_("could not create EMSC_Field");
 
 		/*Create restart file for later */
Index: /issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp	(revision 25826)
+++ /issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp	(revision 25827)
@@ -9,5 +9,5 @@
 #include "../../toolkits/toolkits.h"
 
-void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz,int** prank, Vertices* vertices,bool spherical) {
+void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz,Vertices* vertices,bool spherical) {
 
 	/*figure out how many vertices we have: */
@@ -17,11 +17,9 @@
 	Vector<IssmDouble>* vy=new Vector<IssmDouble>(numberofvertices);
 	Vector<IssmDouble>* vz=new Vector<IssmDouble>(numberofvertices);
-	Vector<IssmDouble>* vrank=NULL;
-	if(prank) vrank = new Vector<IssmDouble>(numberofvertices);
 
 	/*march through our vertices: */
 	for(Object* & object : vertices->objects){
 		Vertex* vertex=(Vertex*)object;
-		vertex->VertexCoordinates(vx,vy,vz,vrank,spherical);
+		vertex->VertexCoordinates(vx,vy,vz,spherical);
 	}
 
@@ -30,5 +28,4 @@
 	vy->Assemble();
 	vz->Assemble();
-	if(prank) vrank->Assemble();
 
 	/*serialize: */
@@ -36,13 +33,4 @@
 	IssmDouble* y=vy->ToMPISerial();
 	IssmDouble* z=vz->ToMPISerial();
-	int* rank = NULL;
-	if(prank){
-		/*Need to convert from IssmDouble to int*/
-		IssmDouble* drank = vrank->ToMPISerial();
-		rank = xNew<int>(numberofvertices);
-		for(int i=0;i<numberofvertices;i++) rank[i] = reCast<int>(drank[i]);
-		xDelete<IssmDouble>(drank);
-		delete vrank;
-	}
 
 	/*Free ressources: */
@@ -58,4 +46,3 @@
 	if(pz) *pz=z;
 	else xDelete<IssmDouble>(z);
-	if(prank) *prank=rank;
 }
Index: /issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.h	(revision 25826)
+++ /issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.h	(revision 25827)
@@ -8,5 +8,5 @@
 
 /* local prototypes: */
-void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz,int** prank,Vertices* vertices,bool spherical=false);
+void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz,Vertices* vertices,bool spherical=false);
 
 #endif  /* _VERTEX_COORDINATESX_H */
