               signal_buffer );
         POP_CHK_CALL_IFSYNC;
 
-        popart::identification::computeResultAllNearbyPoints
-            <<<grid,block,0,_stream>>>
-            ( tagIndex,
-              vCutSize,
-              point_buffer,
-              cut_buffer,
-              signal_buffer );
-        POP_CHK_CALL_IFSYNC;
-
-#if 0
-// #ifdef CPU_GPU_COST_FUNCTION_COMPARE
-    popart::identification::validateSignals
-        <<<1,1,0,_stream>>>
-        ( gridNSample,
-          vCuts.size(),
-          point_buffer,
-          cut_buffer,
-          signal_buffer );
-
-    int aNumber;
-    _meta.fromDevice( Num_nearby_points, aNumber, _stream );
-    cudaStreamSynchronize( _stream );
-    std::cerr << "Number of nearby points on device: " << aNumber << std::endl;
+        dim3 id_block( 32, // we use this to sum up signals
+                       32, // we can use some shared memory/warp magic for summing
+                       1 );
+#ifdef NO_ATOMIC
+        dim3 id_grid( 1,
+                      gridNSample,
+                      gridNSample );
+#else
+        const int numPairs = vCutSize*(vCutSize-1)/2;
+        dim3 id_grid( grid_divide( numPairs, 32 ),
+                gridNSample,
+                gridNSample );
 #endif
+
+        popart::identification::idComputeResult
+            <<<id_grid,id_block,0,_stream>>>
+            ( tagIndex, point_buffer, cut_buffer, signal_buffer, vCutSize );
 
         /* We search for the minimum of gridNSample x gridNSample
          * nearby points. Default for gridNSample is 5.

}

__device__
void extractSignalUsingHomography( const CutStruct&                   cut,
                                   CutSignals*                        signals,
                                   cv::cuda::PtrStepSzb               src,

    ellipse.projectiveTransform( mInvT, transformedEllipse );

    bool first_iteration = true;

    // cerr << "TagIndex: " << tagIndex << " number of loops: " << iterations << endl;

    for( ; iterations>0; iterations-- ) {
        float neighSize = currentNeighbourSize * max( transformedEllipse.a(),
                                                      transformedEllipse.b() );
