     }
 	for (;;) //always try full newton step first
 	{
-        if (threadIdx.x == 0) {
+        if (threadIdx.x == 0) 
 		    x_new = x;
-            cudaDeviceSynchronize();
+
+        __syncthreads();
+        cudaDeviceSynchronize();
+
+        if (threadIdx.x == 0) 
 		    x_new.increment(p, alpha);
-            cudaDeviceSynchronize();
-        }
+
+        __syncthreads();
+        cudaDeviceSynchronize();
 
         //TODO: remove temp variable
 		fl ftemp = f(x_new, g_new);

		    y = g_new;
            // Update line direction
		    subtract_change(y, g, n);
            cudaDeviceSynchronize();

		    prevf0 = f0;
		    f0 = f1;
		    x = x_new;
        }

		if (params.early_term)
		{

            if (threadIdx.x == 0) {
			    x_new = x;
			    g_new.clear(); //dkoes - set gradient to zero
            }
            //TODO: unnecessary? are memset calls issued to the default stream?
            __syncthreads();
            cudaDeviceSynchronize();
			return 0;
		}
		else if (f1 <= f0 + ALF * alpha * slope)
