Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision 266237a46efdbba0be37a76f5e86b6814aac18d7)
+++ src/builder.cpp	(revision 776b64559ecd2f9ada1f26f55c897028165fb398)
@@ -254,5 +254,5 @@
         } while ((j != -1) && (i<128));
         if (i >= 2) {
-          first->x.LSQdistance(atoms, i);
+          first->x.LSQdistance((const Vector **)atoms, i);
 
           first->x.Output((ofstream *)&cout);
@@ -592,9 +592,11 @@
       {
         cout << Verbose(0) << "Evaluating volume of the convex envelope.";
-        LinkedCell LCList(mol, 10.);
         class Tesselation *TesselStruct = NULL;
-        FindConvexBorder((ofstream *)&cout, mol, &LCList, NULL);
+        const LinkedCell *LCList = NULL;
+        LCList = new LinkedCell(mol, 10.);
+        FindConvexBorder((ofstream *)&cout, mol, TesselStruct, LCList, NULL);
         double clustervolume = VolumeOfConvexEnvelope((ofstream *)&cout, TesselStruct, configuration);
-        cout << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;
+        cout << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\
+        delete(LCList);
         delete(TesselStruct);
       }
@@ -720,5 +722,5 @@
        cin >> factor[2];
        valid = true;
-       mol->Scale(&factor);
+       mol->Scale((const double ** const)&factor);
        delete[](factor);
       }
@@ -1588,17 +1590,20 @@
                 // get the boundary
                 class molecule *Boundary = new molecule(periode);
+                class Tesselation *TesselStruct = NULL;
                 struct ConfigFileBuffer *FileBuffer = NULL;
                 PrepareFileBuffer(argv[argptr], FileBuffer);
                 LoadMolecule(Boundary, FileBuffer, periode, false);
-                LinkedCell LCList(Boundary, 2.*radius);
+                const LinkedCell *LCList = NULL;
+                LCList = new LinkedCell(Boundary, 2.*radius);
                 element *oxygen = periode->FindElement(8);
-                FindNonConvexBorder((ofstream *)&cout, Boundary, &LCList, radius, NULL);
-
-                CorrelationToSurfaceMap *surfacemap = CorrelationToSurface( (ofstream *)&cout, mol, oxygen, Boundary->TesselStruct, &LCList );
+                FindNonConvexBorder((ofstream *)&cout, Boundary, TesselStruct, LCList, radius, NULL);
+                CorrelationToSurfaceMap *surfacemap = CorrelationToSurface( (ofstream *)&cout, mol, oxygen, TesselStruct, LCList );
                 BinPairMap *binmap = BinData( (ofstream *)&cout, surfacemap, 0.5, 0., 0. );
                 OutputCorrelation ( &binoutput, binmap );
                 output.close();
                 binoutput.close();
+                delete(LCList);
                 delete(FileBuffer);
+                delete(TesselStruct);
                 delete(Boundary);
                 argptr+=3;
@@ -1675,5 +1680,6 @@
                 cerr << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl;
               } else {
-                class Tesselation T;
+                class Tesselation *T = NULL;
+                const LinkedCell *LCList = NULL;
                 string filename(argv[argptr+1]);
                 filename.append(".csv");
@@ -1681,9 +1687,10 @@
                 cout << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl;
                 start = clock();
-                LinkedCell LCList(mol, atof(argv[argptr])*2.);
-                FindNonConvexBorder((ofstream *)&cout, mol, &LCList, atof(argv[argptr]), argv[argptr+1]);
-                //FindDistributionOfEllipsoids((ofstream *)&cout, &T, &LCList, N, number, filename.c_str());
+                LCList = new LinkedCell(mol, atof(argv[argptr])*2.);
+                FindNonConvexBorder((ofstream *)&cout, mol, T, LCList, atof(argv[argptr]), argv[argptr+1]);
+                //FindDistributionOfEllipsoids((ofstream *)&cout, T, &LCList, N, number, filename.c_str());
                 end = clock();
                 cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
+                delete(LCList);
                 argptr+=2;
               }
@@ -1806,5 +1813,5 @@
                 factor[1] = atof(argv[argptr+1]);
                 factor[2] = atof(argv[argptr+2]);
-                mol->Scale(&factor);
+                mol->Scale((const double ** const)&factor);
                 for (int i=0;i<NDIM;i++) {
                   j += i+1;
@@ -1935,15 +1942,19 @@
                 cerr << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl;
               } else {
+                class Tesselation *TesselStruct = NULL;
+                const LinkedCell *LCList = NULL;
                 cout << Verbose(0) << "Evaluating volume of the convex envelope.";
                 cout << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl;
                 cout << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl;
-                LinkedCell LCList(mol, 10.);
-                //FindConvexBorder((ofstream *)&cout, mol, &LCList, argv[argptr]);
-                FindNonConvexBorder((ofstream *)&cout, mol, &LCList, 5., argv[argptr+1]);
-//                RemoveAllBoundaryPoints((ofstream *)&cout, mol->TesselStruct, mol, argv[argptr]);
-                double volumedifference = ConvexizeNonconvexEnvelope((ofstream *)&cout, mol->TesselStruct, mol, argv[argptr]);
-                double clustervolume = VolumeOfConvexEnvelope((ofstream *)&cout, mol->TesselStruct, &configuration);
+                LCList = new LinkedCell(mol, 10.);
+                //FindConvexBorder((ofstream *)&cout, mol, LCList, argv[argptr]);
+                FindNonConvexBorder((ofstream *)&cout, mol, TesselStruct, LCList, 5., argv[argptr+1]);
+//                RemoveAllBoundaryPoints((ofstream *)&cout, TesselStruct, mol, argv[argptr]);
+                double volumedifference = ConvexizeNonconvexEnvelope((ofstream *)&cout, TesselStruct, mol, argv[argptr]);
+                double clustervolume = VolumeOfConvexEnvelope((ofstream *)&cout, TesselStruct, &configuration);
                 cout << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;
                 cout << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;
+                delete(TesselStruct);
+                delete(LCList);
                 argptr+=2;
               }
