diff --git a/aprod.c b/aprod.c
index 10e16fbb910d60c1e63b47d3cc5c10668ce3157c..7a8b8802e6967a70d061138ec6f145fd008b6a7d 100644
--- a/aprod.c
+++ b/aprod.c
@@ -39,9 +39,12 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms,
     nproc = comlsqr.nproc;
     mapNcoeff = comlsqr.mapNcoeff;
     mapNoss = comlsqr.mapNoss;
+    if (comlsqr.nthreads == NULL)
+        comlsqr.nthreads=1;
+        
     nthreads = comlsqr.nthreads;
-    ntasks= comlsqr.ntasks;
     
+    ntasks= comlsqr.ntasks;
     mapForThread = comlsqr.mapForThread;
     int multMI = comlsqr.multMI;
     long nparam = comlsqr.parOss;
@@ -72,10 +75,8 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms,
     long offsetInstrParam = comlsqr.offsetInstrParam;
     long offsetGlobParam = comlsqr.offsetGlobParam;
 
-
     tid = 0;
 
-
     if (mode != 1 && mode != 2)
     {
         printf("ERROR: Invalid mode=%d in aprod function\n", mode);
@@ -86,15 +87,13 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms,
     myid = comlsqr.myid;
     if (mode == 1)
     {
-        
-        
         time_t startTime = time(NULL);
-        {
-            myid = comlsqr.myid;
-            
+        
+        myid = comlsqr.myid;
+
+        if (comlsqr.itn == 1 && debugMode)
+            printf("PE=%d Aprod1 OpenMP num of threads =%d from thread =%d icycle=%ld  comlsqr.itn=%d\n", myid, nthreads, tid, i, comlsqr.itn);
             
-            if (comlsqr.itn == 1 && debugMode)
-                printf("PE=%d Aprod1 OpenMP num of threads =%d from thread =%d icycle=%ld  comlsqr.itn=%d\n", myid, nthreads, tid, i, comlsqr.itn);
             long miValAstro = 0;
             long miValAtt = 0;
             long jstartAtt = 0;
@@ -112,7 +111,6 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms,
             long offLocalGlob = offsetGlobParam + (localAstroMax - offsetAttParam); //Offset on GlobP
             int nGlobVal = nAstroPSolved + nAttP + nInstrPSolved;
             jstartAstro = miValAstro - offLocalAstro;
-          
             
             for(int nt=0; nt < ntasks; nt++ )
             {
@@ -120,76 +118,9 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms,
                 {
                     for (long ix = mapForThread[nt][0]; ix < mapForThread[nt][2]; ix++)  //FUNZIONE DA FARE
                     {
-
-/*================= INIZIO
-                        sum = 0.;   // FARE UNA FUNZIONE CHIAMATA NEL CICLO FOR
-                        /////////////////////////////////////////////////////
-                        /// Mode 1 Astrometric Sect
-                        if (nAstroPSolved)
-                        {
-
-                            lset = ix * nparam;
-                            if (matrixIndex[multMI * ix] != miValAstro)
-                            {
-                                miValAstro = matrixIndex[multMI * ix];
-                                jstartAstro = miValAstro - offLocalAstro;
-                            }
-                            for (long jx = jstartAstro; jx < jstartAstro + nAstroPSolved; jx++)
-                            {
-                                sum = sum + systemMatrix[lset] * vVect[jx];
-                                lset++;
-                            }
-                        }
-                        //////////////////////////////////////////////////////
-                        /// Mode 1 Attitude Sect
-                        if (nAttP)
-                        {
-                            lset = ix * nparam + nAstroPSolved;
-                            miValAtt = matrixIndex[multMI * ix + (multMI - 1)];
-                            for (int nax = 0; nax < nAttAxes; nax++)
-                            {
-                                jstartAtt = miValAtt + offLocalAtt + nax * nDegFreedomAtt;
-                                for (long inpax = jstartAtt; inpax < jstartAtt + nAttParAxis; inpax++)
-                                {
-                                    sum = sum + systemMatrix[lset] * vVect[inpax];
-                                    lset++;
-                                }
-                            }
-                        }
-                        //////////////////////////////////////////////////////
-                        /// Mode 1 Instrument Sect
-                        if (nInstrPSolved)
-                        {
-
-                            lset = ix * nparam + nInstrVal;
-                            long iiVal = ix * nInstrPSolved;
-                            for (int inInstr = 0; inInstr < nInstrPSolved; inInstr++)
-                            {
-                                ixInstr = offLocalInstr + instrCol[iiVal + inInstr];
-                                sum = sum + systemMatrix[lset] * vVect[ixInstr];
-                                lset++;
-                            }
-                        }
-                        //////////////////////////////////////////////////////
-                        /// Mode 1 Global sect
-                        if (nGlobP)
-                        {
-                            lset = ix * nparam + nGlobVal;
-                            for (long inGlob = offLocalGlob; inGlob < offLocalGlob + nGlobP; inGlob++)
-                            {
-                                sum = sum + systemMatrix[lset] * vVect[inGlob];
-                                lset++;
-                            }
-                        }
-                        //////////////////////////////////////////////////////
-                       // knownTerms[ix] += sum;
-================ FINE */
-
                         knownTerms[ix] += aprodM1Obs(ix,comlsqr, vVect, systemMatrix, matrixIndex, instrCol);
-
                     } //for ix
                 }
-
             }
 
             /// Mode 1 ExtConstr
@@ -266,7 +197,7 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms,
                 }
             }
             //////////////////////////////////////////////////////
-        } //pragma
+
         *ompSec += time(NULL) - startTime;
         if (comlsqr.itn <= 2 && (myid == 0 || myid == nproc - 1 || debugMode == 1))
             printf("PE=%d AprodTiming: mode=1  OmpSec=%ld\n", myid, time(NULL) - startTime);
diff --git a/util.h b/util.h
index cd64880d9f75d0834692ec7646888944eedad037..42eb85ac2c569fa90ee2ce94c0411b776cb6f795 100644
--- a/util.h
+++ b/util.h
@@ -102,7 +102,7 @@ struct comData {
 	int timeCPR, timeLimit, itnCPR,itnCPRstop,itnCPRend, itnLimit,itn,noCPR;
     long offsetCMag,offsetCnu,offsetCdelta_eta,offsetCDelta_eta_1,offsetCDelta_eta_2;
     long offsetCDelta_eta_3,offsetCdelta_zeta,offsetCDelta_zeta_1,offsetCDelta_zeta_2;
-	int nthreads=1;
+	int nthreads;
 	int ntasks;
 	long **mapForThread;
 	int nSubsetAtt, nSubsetInstr;