diff --git a/allvars.c b/allvars.c
index 6e2cb8ab42675312e54577b778aa2a1a9b849cdb..95d09f53777038f4830cceb17c184a368e2908e1 100644
--- a/allvars.c
+++ b/allvars.c
@@ -23,10 +23,11 @@ double resolution, dx, dw, w_supporth;
 clock_t start, end, start0, startk, endk;
 struct timespec begin, finish, begin0, begink, finishk;
 
-struct sectorlist ** sectorhead;
 long * histo_send, size_of_grid;
 double * grid, *gridss, *gridss_real, *gridss_img, *gridss_w;
 
 #ifdef USE_MPI
     MPI_Win slabwin;
 #endif
+
+long **sectorarray;
diff --git a/allvars.h b/allvars.h
index 0c31127a8155bba365207294209578c0d6e0279d..e04c1654b5f8840a338777ac49ab8162e700c41a 100644
--- a/allvars.h
+++ b/allvars.h
@@ -112,11 +112,6 @@ extern struct fileData
         float * visimg;
 }data;
 
-extern struct sectorlist {
-     long index;
-     struct sectorlist * next;
-}** sectorhead;
-
 
 extern char filename[1000], buf[30], num_buf[30];
 extern char datapath[900];
@@ -135,3 +130,5 @@ extern double * grid, *gridss, *gridss_real, *gridss_img, *gridss_w;
 #ifdef USE_MPI
     extern  MPI_Win slabwin;
 #endif
+
+extern long **sectorarray;
diff --git a/gridding.c b/gridding.c
index f59bc44d43f1eb5a758f4cbe05a8357d063a9834..1b57c94986db0e5ff906e86d03491b4f46c99de6 100644
--- a/gridding.c
+++ b/gridding.c
@@ -2,12 +2,6 @@
 #include "allvars.h"
 #include "proto.h"
 
-void Push(struct sectorlist** headRef, long data) {
-     struct sectorlist* newNode = malloc(sizeof(struct sectorlist));
-     newNode->index = data;
-     newNode->next = *headRef;
-     *headRef = newNode;
-}
 
 void gridding(){
 
@@ -19,7 +13,7 @@ void gridding(){
     start = clock();
 
     // Initialize linked list
-    initialize_list();
+    initialize_array();
 
     //Sector and Gridding data
     gridding_data();
@@ -37,16 +31,7 @@ void gridding(){
 
 }
 
-void initialize_list(){
-
-    sectorhead = (struct sectorlist **) malloc((nsectors+1) * sizeof(struct sectorlist));
-    for (int isec=0; isec<=nsectors; isec++)
-    {
-            sectorhead[isec] = malloc(sizeof(struct sectorlist));
-            sectorhead[isec]->index = -1;
-            sectorhead[isec]->next = NULL;
-    }
-
+void initialize_array(){
 
     histo_send = (long*) calloc(nsectors+1,sizeof(long));
     int * boundary = (int*) calloc(metaData.Nmeasures,sizeof(int));
@@ -54,33 +39,49 @@ void initialize_list(){
     for (long iphi = 0; iphi < metaData.Nmeasures; iphi++)
     {
      	   boundary[iphi] = -1;
-           uuh = data.uu[iphi];
-           vvh = data.vv[iphi];
-           int binphi = (int)(vvh*nsectors);
+           vvh = data.vv[iphi];  //less or equal to 0.6
+           int binphi = (int)(vvh*nsectors); //has values expect 0 and nsectors-1. So we use updist and downdist condition
            // check if the point influence also neighboring slabs
            double updist = (double)((binphi+1)*yaxis)*dx - vvh;
            double downdist = vvh - (double)(binphi*yaxis)*dx;
            //
            histo_send[binphi]++;
-           Push(&sectorhead[binphi],iphi);
-           if(updist < w_supporth && updist >= 0.0) {histo_send[binphi+1]++; boundary[iphi] = binphi+1; Push(&sectorhead[binphi+1],iphi);};
-              if(downdist < w_supporth && binphi > 0 && downdist >= 0.0) {histo_send[binphi-1]++; boundary[iphi] = binphi-1; Push(&sectorhead[binphi-1],iphi);};
+           if(updist < w_supporth && updist >= 0.0) {histo_send[binphi+1]++; boundary[iphi] = binphi+1;};
+           if(downdist < w_supporth && binphi > 0 && downdist >= 0.0) {histo_send[binphi-1]++; boundary[iphi] = binphi-1;};
+    }
+
+    sectorarray = (long**)malloc ((nsectors+1) * sizeof(long*));
+    for(int sec=0; sec<(nsectors+1); sec++)
+    {
+      	   sectorarray[sec] = (long*)malloc(histo_send[sec]*sizeof(long));
     }
-    #ifdef PIPPO
-        struct sectorlist * current;
+
+    long *counter = (long*) calloc(nsectors+1,sizeof(long));
+    for (long iphi = 0; iphi < metaData.Nmeasures; iphi++)
+    {
+           vvh = data.vv[iphi];
+           int binphi = (int)(vvh*nsectors);
+           double updist = (double)((binphi+1)*yaxis)*dx - vvh;
+           double downdist = vvh - (double)(binphi*yaxis)*dx;
+           sectorarray[binphi][counter[binphi]] = iphi;
+           counter[binphi]++;
+           if(updist < w_supporth && updist >= 0.0) { sectorarray[binphi+1][counter[binphi+1]] = iphi; counter[binphi+1]++;};
+           if(downdist < w_supporth && binphi > 0 && downdist >= 0.0) { sectorarray[binphi-1][counter[binphi-1]] = iphi; counter[binphi-1]++;};
+    }
+     
+    
+   #ifdef PIPPO
         long iiii = 0;
         for (int j=0; j<nsectors; j++)
         {
-                current = sectorhead[j];
                 iiii = 0;
-                while (current->index != -1)
+                for(long iphi = histo_send[j]-1; iphi>=0; iphi--)
                 {
-                        printf("%d %d %ld %ld %ld\n",rank,j,iiii,histo_send[j],current->index);
-                        current = current->next;
-                        iiii++;
+                      printf("%d %d %ld %ld %ld\n",rank,j,iiii,histo_send[j],sectorarray[j][iphi]);
+                      iiii++;
                 }
         }
-    #endif
+   #endif
 
     #ifdef VERBOSE
         for (int iii=0; iii<nsectors+1; iii++)printf("HISTO %d %d %ld\n",rank, iii, histo_send[iii]);
@@ -89,21 +90,6 @@ void initialize_list(){
 
 void gridding_data(){
 
-    // Create sector grid
-
-    size_of_grid = 2*param.num_w_planes*xaxis*yaxis;
-    gridss = (double*) calloc(size_of_grid,sizeof(double));
-    gridss_w = (double*) calloc(size_of_grid,sizeof(double));
-    gridss_real = (double*) calloc(size_of_grid/2,sizeof(double));
-    gridss_img = (double*) calloc(size_of_grid/2,sizeof(double));
-  
-    // Create destination slab
-    grid = (double*) calloc(size_of_grid,sizeof(double));
-  
-    // Create temporary global grid
-    #ifndef USE_MPI
-        double * gridtot = (double*) calloc(2*grid_size_x*grid_size_y*num_w_planes,sizeof(double));
-    #endif
     double shift = (double)(dx*yaxis);
     
     // Open the MPI Memory Window for the slab
@@ -152,12 +138,10 @@ void gridding_data(){
         long icount = 0;
         long ip = 0;
         long inu = 0;
-        struct sectorlist * current;
-        current = sectorhead[isector];
 
-         while (current->index != -1)
-         {
-              long ilocal = current->index;
+        for(long iphi = histo_send[isector]-1; iphi>=0; iphi--)
+        {
+              long ilocal = sectorarray[isector][iphi];
               //double vvh = data.vv[ilocal];
               //int binphi = (int)(vvh*nsectors);
               //if (binphi == isector || boundary[ilocal] == isector) {
@@ -177,7 +161,6 @@ void gridding_data(){
                      inu++;
 		}
               icount++;
-              current = current->next;
          }
 
          clock_gettime(CLOCK_MONOTONIC, &finishk);
diff --git a/init.c b/init.c
index 9b2d3cc71d809aed6c6a118b0cba59ae467e09f5..35711ccffe1a610e1f92e28d462dd7b3a2d27b91 100644
--- a/init.c
+++ b/init.c
@@ -348,6 +348,23 @@ void allocate_memory() {
      data.visreal = (float*) calloc(metaData.Nvis,sizeof(float));
      data.visimg = (float*) calloc(metaData.Nvis,sizeof(float));
 
+
+     // Create sector grid
+     
+     size_of_grid = 2*param.num_w_planes*xaxis*yaxis;
+     gridss = (double*) calloc(size_of_grid,sizeof(double));
+     gridss_w = (double*) calloc(size_of_grid,sizeof(double));
+     gridss_real = (double*) calloc(size_of_grid/2,sizeof(double));
+     gridss_img = (double*) calloc(size_of_grid/2,sizeof(double));
+     
+     // Create destination slab
+      grid = (double*) calloc(size_of_grid,sizeof(double));
+     
+     // Create temporary global grid
+     #ifndef USE_MPI
+     	   double * gridtot = (double*) calloc(2*grid_size_x*grid_size_y*num_w_planes,sizeof(double));
+     #endif
+
 }
 
 void readData() {
diff --git a/proto.h b/proto.h
index 9fb9b065867174e3e36e02ac4b14d7552b94fabc..977f2f03958392f7512ba72eee1ba285b3a6f602 100644
--- a/proto.h
+++ b/proto.h
@@ -16,8 +16,7 @@ void readData();
 /*  gridding.c */
 
 void gridding();
-void Push(struct sectorlist** headRef, long data);
-void initialize_list();
+void initialize_array();
 void gridding_data();
 void write_grided_data();