diff --git a/openfpm_data b/openfpm_data
index 49040a1f74848f700ffda26002d98191b25ea813..7c9737c9de9051c7af21edceee29c0aa11cc8afa 160000
--- a/openfpm_data
+++ b/openfpm_data
@@ -1 +1 @@
-Subproject commit 49040a1f74848f700ffda26002d98191b25ea813
+Subproject commit 7c9737c9de9051c7af21edceee29c0aa11cc8afa
diff --git a/openfpm_devices b/openfpm_devices
index 55db81226f047b3dfea1e3b276b67ee8374651b0..18cad2e78602aa5f55f04926c327a7864d67b756 160000
--- a/openfpm_devices
+++ b/openfpm_devices
@@ -1 +1 @@
-Subproject commit 55db81226f047b3dfea1e3b276b67ee8374651b0
+Subproject commit 18cad2e78602aa5f55f04926c327a7864d67b756
diff --git a/openfpm_io b/openfpm_io
index 935c25aaa275530ef1dafb86b7a9074e649a1d1f..b7238aac71a82a304a7d455a8a62fc1149168fb5 160000
--- a/openfpm_io
+++ b/openfpm_io
@@ -1 +1 @@
-Subproject commit 935c25aaa275530ef1dafb86b7a9074e649a1d1f
+Subproject commit b7238aac71a82a304a7d455a8a62fc1149168fb5
diff --git a/openfpm_numerics b/openfpm_numerics
index b4d8373acf148fcfb868fc3edff3eb2aed78c881..6ad651779c654df68af427d6294bc4ba368a372e 160000
--- a/openfpm_numerics
+++ b/openfpm_numerics
@@ -1 +1 @@
-Subproject commit b4d8373acf148fcfb868fc3edff3eb2aed78c881
+Subproject commit 6ad651779c654df68af427d6294bc4ba368a372e
diff --git a/openfpm_vcluster b/openfpm_vcluster
index 54fcd2aeb78744c3b4f085d8f58b86cb8e325e52..b57540c803a8b7c269013f4a3c59b3f148d71edc 160000
--- a/openfpm_vcluster
+++ b/openfpm_vcluster
@@ -1 +1 @@
-Subproject commit 54fcd2aeb78744c3b4f085d8f58b86cb8e325e52
+Subproject commit b57540c803a8b7c269013f4a3c59b3f148d71edc
diff --git a/src/Grid/grid_dist_id.hpp b/src/Grid/grid_dist_id.hpp
index 67b80376e4b8333576cd3d69887ad94f9dfd21f9..6f685d8dbc81ed0c95df73570e4cea98378f0a19 100644
--- a/src/Grid/grid_dist_id.hpp
+++ b/src/Grid/grid_dist_id.hpp
@@ -405,26 +405,39 @@ class grid_dist_id
 		}
 	}
 
-public:
-
-	// Which kind of grid the structure store
-	typedef device_grid d_grid;
+	/*! \brief Default Copy constructor on this class make no sense and is unsafe, this definition disable it
+	 *
+	 */
+	grid_dist_id(const grid_dist_id<dim,St,T,Decomposition,Memory,device_grid> & g)
+	{
+	}
 
-	//! constructor
-	grid_dist_id(Vcluster v_cl, Decomposition & dec, const size_t (& g_sz)[dim], const Box<dim,St> & domain, const Ghost<dim,T> & ghost)
-	:domain(domain),ghost(ghost),loc_grid(NULL),v_cl(v_cl),dec(dec),ginfo(g_sz),ginfo_v(g_sz)
+	/*! \brief Initialize the Cell decomposer of the grid
+	 *
+	 *
+	 */
+	inline void InitializeCellDecomposer(const size_t (& g_sz)[dim])
 	{
+		// check that the grid has valid size
 		check_size(g_sz);
 
 		// For a 5x5 grid you have 4x4 Cell
 		size_t c_g[dim];
-		for (size_t i = 0 ; i < dim ; i++)	{c_g[i] = g_sz[i]-1;}
+		for (size_t i = 0 ; i < dim ; i++)	{c_g[i] = (g_sz[i]-1 > 0)?(g_sz[i]-1):1;}
 
 		// Initialize the cell decomposer
 		cd_sm.setDimensions(domain,c_g,0);
+	}
 
+	/*! \brief Initialize the grid
+	 *
+	 * \param g_sz Global size of the grid
+	 *
+	 */
+	inline void InitializeStructures(const size_t (& g_sz)[dim])
+	{
 		// fill the global size of the grid
-		for (int i = 0 ; i < dim ; i++)	{this->g_sz[i] = g_sz[i];}
+		for (size_t i = 0 ; i < dim ; i++)	{this->g_sz[i] = g_sz[i];}
 
 		// Get the number of processor and calculate the number of sub-domain
 		// for decomposition
@@ -434,17 +447,33 @@ public:
 		// Calculate the maximum number (before merging) of sub-domain on
 		// each dimension
 		size_t div[dim];
-		for (int i = 0 ; i < dim ; i++)
+		for (size_t i = 0 ; i < dim ; i++)
 		{div[i] = openfpm::math::round_big_2(pow(n_sub,1.0/dim));}
 
 		// Create the sub-domains
-		dec.setParameters(div);
+		dec.setParameters(div,domain,ghost);
 
 		// Create local grid
 		Create();
 
 		// Calculate ghost boxes
-		dec.calculateGhostBoxes(ghost);
+		dec.calculateGhostBoxes();
+	}
+
+public:
+
+	// Which kind of grid the structure store
+	typedef device_grid d_grid;
+
+	// Decomposition used
+	typedef Decomposition decomposition;
+
+	//! constructor
+	grid_dist_id(Vcluster v_cl, Decomposition & dec, const size_t (& g_sz)[dim] , const Box<dim,St> & domain, const Ghost<dim,T> & ghost)
+	:domain(domain),ghost(ghost),loc_grid(NULL),v_cl(v_cl),dec(dec),ginfo(g_sz),ginfo_v(g_sz)
+	{
+		InitializeCellDecomposer(g_sz);
+		InitializeStructures(g_sz);
 	}
 
 	/*! \brief Constrcuctor
@@ -457,38 +486,37 @@ public:
 	grid_dist_id(const size_t (& g_sz)[dim],const Box<dim,St> & domain, const Ghost<dim,St> & g)
 	:domain(domain),ghost(g),dec(Decomposition(*global_v_cluster)),v_cl(*global_v_cluster),ginfo(g_sz),ginfo_v(g_sz)
 	{
-		// check that the grid has valid size
-		check_size(g_sz);
-
-		// For a 5x5 grid you have 4x4 Cell
-		size_t c_g[dim];
-		for (size_t i = 0 ; i < dim ; i++)	{c_g[i] = (g_sz[i]-1 > 0)?(g_sz[i]-1):1;}
+		InitializeCellDecomposer(g_sz);
+		InitializeStructures(g_sz);
+	}
 
-		// Initialize the cell decomposer
-		cd_sm.setDimensions(domain,c_g,0);
+	/*! \brief Constrcuctor
+	 *
+	 * \param g_sz array with the grid size on each dimension
+	 * \param domain domain where this grid live
+	 * \param g Ghost given in grid units
+	 *
+	 */
+	grid_dist_id(const size_t (& g_sz)[dim],const Box<dim,St> & domain, const Ghost<dim,size_t> & g)
+	:domain(domain),dec(Decomposition(*global_v_cluster)),v_cl(*global_v_cluster),ginfo(g_sz),ginfo_v(g_sz)
+	{
+		InitializeCellDecomposer(g_sz);
 
-		// fill the global size of the grid
-		for (size_t i = 0 ; i < dim ; i++)	{this->g_sz[i] = g_sz[i];}
+		// get the grid spacing
+		Box<dim,St> sp = cd_sm.getCellBox();
 
-		// Get the number of processor and calculate the number of sub-domain
-		// for decomposition
-		size_t n_proc = v_cl.getProcessingUnits();
-		size_t n_sub = n_proc * SUB_UNIT_FACTOR;
+		// enlarge 0.001 of the spacing
+		sp.magnify_fix_P1(0.001);
 
-		// Calculate the maximum number (before merging) of sub-domain on
-		// each dimension
-		size_t div[dim];
+		// set the ghost
 		for (size_t i = 0 ; i < dim ; i++)
-		{div[i] = openfpm::math::round_big_2(pow(n_sub,1.0/dim));}
-
-		// Create the sub-domains
-		dec.setParameters(div,domain,ghost);
-
-		// Create local grid
-		Create();
+		{
+			ghost.setLow(i,sp.getHigh(i));
+			ghost.setHigh(i,sp.getHigh(i));
+		}
 
-		// Calculate ghost boxes
-		dec.calculateGhostBoxes();
+		// Initialize structures
+		InitializeStructures(g_sz);
 	}
 
 	/*! \brief Get an object containing the grid informations
@@ -547,6 +575,31 @@ public:
 		return true;
 	}
 
+	/*! \brief Get the size of local domain grids
+	 *
+	 * \return The size of the local domain
+	 *
+	 */
+	size_t getLocalDomainSize()
+	{
+		size_t total = 0;
+
+		for (size_t i = 0 ; i < gdb_ext.size() ; i++)
+		{
+			total += gdb_ext.Dbox.getVolumeKey();
+		}
+	}
+
+	/*! \brief It return the informations about the local grids
+	 *
+	 * \return The information about the local grids
+	 *
+	 */
+	const openfpm::vector<GBoxes<device_grid::dims>> & getLocalGridsInfo()
+	{
+		return gdb_ext;
+	}
+
 	/*! \brief It return an iterator that span the full grid domain (each processor span its local domain)
 	 *
 	 * \return the iterator
diff --git a/src/Grid/grid_dist_id_unit_test.hpp b/src/Grid/grid_dist_id_unit_test.hpp
index 73e04ad426f50beff419e3a11ececede901dd525..c7cdd63ce7f608c5bf0dfbe49578942817ef53e3 100644
--- a/src/Grid/grid_dist_id_unit_test.hpp
+++ b/src/Grid/grid_dist_id_unit_test.hpp
@@ -181,7 +181,7 @@ void Test2D_sub(const Box<2,float> & domain, long int k)
 			BOOST_REQUIRE_EQUAL(key_g.get(0),k/2);
 			BOOST_REQUIRE_EQUAL(key_g.get(1),k/2);
 
-			key_s_it = dom.getGKey(key);
+			auto key_s_it = dom.getGKey(key);
 
 			BOOST_REQUIRE_EQUAL(key_g.get(0),key_s_it.get(0));
 			BOOST_REQUIRE_EQUAL(key_g.get(1),key_s_it.get(1));
@@ -528,6 +528,53 @@ void Test3D(const Box<3,float> & domain, long int k)
 	}
 }
 
+
+void Test3D_gg(const Box<3,float> & domain, long int k, long int gk)
+{
+	long int big_step = k / 30;
+	big_step = (big_step == 0)?1:big_step;
+	long int small_step = 1;
+
+	print_test( "Testing 3D grid k<=",k);
+
+	// 3D test
+	for ( ; k >= 2 ; k /= 2 )
+	{
+		BOOST_TEST_CHECKPOINT( "Testing 3D grid ghost integer k=" << k );
+
+		// grid size
+		size_t sz[3];
+		sz[0] = k;
+		sz[1] = k;
+		sz[2] = k;
+
+		// factor
+		float factor = pow(global_v_cluster->getProcessingUnits()/2.0f,1.0f/3.0f);
+
+		// Ghost
+		Ghost<3,size_t> g(gk);
+
+		// Distributed grid with id decomposition
+		grid_dist_id<3, float, scalar<float>, CartDecomposition<3,float>> g_dist(sz,domain,g);
+
+		// check the consistency of the decomposition
+		bool val = g_dist.getDecomposition().check_consistency();
+		BOOST_REQUIRE_EQUAL(val,true);
+
+		auto lg = g_dist.getLocalGridsInfo();
+
+		// for each local grid check that the border is 1 point
+		// (Warning this property can only be ensured with k is a multiple of 2)
+		// in the other case it will be mostly like that but cannot be ensured
+
+		for (size_t i = 0 ; i < lg.size() ; i++)
+		{
+			BOOST_REQUIRE_EQUAL(lg.get(i).Dbox.getLow(i),gk);
+			BOOST_REQUIRE_EQUAL(lg.get(i).GDbox.getHigh(i)- lg.get(i).Dbox.getHigh(i),gk);
+		}
+	}
+}
+
 void Test2D_complex(const Box<2,float> & domain, long int k)
 {
 	typedef Point_test<float> p;
@@ -894,6 +941,26 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_sub_iterator_test_use)
 	Test3D_sub(domain3,k);
 }
 
+BOOST_AUTO_TEST_CASE( grid_dist_id_with_grid_unit_ghost )
+{
+	// Domain
+	Box<2,float> domain({0.0,0.0},{1.0,1.0});
+
+	// Initialize the global VCluster
+	init_global_v_cluster(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv);
+
+	long int k = 1024*1024*global_v_cluster->getProcessingUnits();
+	k = std::pow(k, 1/2.);
+
+//	Test2D_gg(domain,k);
+	// Domain
+	Box<3,float> domain3({0.0,0.0,0.0},{1.0,1.0,1.0});
+
+	k = 128*128*128*global_v_cluster->getProcessingUnits();
+	k = std::pow(k, 1/3.);
+	Test3D_gg(domain3,k,1);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 #endif
diff --git a/src/Makefile.am b/src/Makefile.am
index d96f3e68328111128a8553177bebe932fb57ae8c..3727abe24b6a25830dd5bbd1537aa829a4b3ef97 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
 LINKLIBS = $(METIS_LIB) $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_IOSTREAMS_LIB) $(CUDA_LIBS)
 
 noinst_PROGRAMS = pdata
-pdata_SOURCES = main.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_data/src/Memleak_check.cpp
+pdata_SOURCES = main.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
 pdata_CXXFLAGS = $(CUDA_CFLAGS) $(INCLUDES_PATH) $(METIS_INCLUDE) $(BOOST_CPPFLAGS) -Wno-unused-function
 pdata_CFLAGS = $(CUDA_CFLAGS)
 pdata_LDADD = $(LINKLIBS) -lmetis
diff --git a/vtk/Makefile.am b/vtk/Makefile.am
index cc819623bb9c04b47782431ecff014bc24530ee3..edf8462bcc47ae8dbe26cc23d9dad0c32114f164 100644
--- a/vtk/Makefile.am
+++ b/vtk/Makefile.am
@@ -2,17 +2,17 @@
 LINKLIBS = $(METIS_LIB) $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_IOSTREAMS_LIB) $(CUDA_LIBS)
 
 noinst_PROGRAMS = cart_dec metis_dec dom_box
-cart_dec_SOURCES = CartDecomposition_gen_vtk.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_data/src/Memleak_check.cpp
+cart_dec_SOURCES = CartDecomposition_gen_vtk.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
 cart_dec_CXXFLAGS = $(CUDA_CFLAGS) $(INCLUDES_PATH) $(METIS_INCLUDE) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function
 cart_dec_CFLAGS = $(CUDA_CFLAGS)
 cart_dec_LDADD = $(LINKLIBS) -lmetis
 
-metis_dec_SOURCES = Metis_gen_vtk.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_data/src/Memleak_check.cpp
+metis_dec_SOURCES = Metis_gen_vtk.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
 metis_dec_CXXFLAGS = $(CUDA_CFLAGS) $(INCLUDES_PATH) $(METIS_INCLUDE) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function
 metis_dec_CFLAGS = $(CUDA_CFLAGS)
 metis_dec_LDADD = $(LINKLIBS) -lmetis
 
-dom_box_SOURCES = domain_gen_vtk.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_data/src/Memleak_check.cpp
+dom_box_SOURCES = domain_gen_vtk.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
 dom_box_CXXFLAGS = $(CUDA_CFLAGS) $(INCLUDES_PATH) $(METIS_INCLUDE) $(BOOST_CPPFLAGS) -I../src -Wno-unused-function
 dom_box_CFLAGS = $(CUDA_CFLAGS)
 dom_box_LDADD = $(LINKLIBS)