 */  
 
 
-  // Check for kernel errors
-  cudaerr = cudaGetLastError();
-  if (cudaerr != cudaSuccess)
-    printf("Error: %s\n", cudaGetErrorString(cudaerr));
-
-
-  printf("Transfering 'dist' matrix from device to host.\n");
-  CUDA_CHECK(cudaMemcpy(dist, deviceDist, Q*N*sizeof(double), 
-                        cudaMemcpyDeviceToHost));
-
   // Only for debugging purposes.
-
-  int i, qi;
+/*
   int max_qi = Q;
   // if N is greater than 10K, then print only the first 10K elements
   int max_i = (N > 10000) ? 10000 : N; 
   
-  for(qi=0; qi<max_qi; qi++){
-    for(i=0; i<max_i; i++){  
+  for (int qi = 0; qi < max_qi; qi++) {
+    for (int i = 0; i < max_i; i++) {  
       printf("qi = %d, i = %d, dist = %f\n", qi, i, dist[qi*N + i]);
     }
   }
-/**/
+*/
 
   cudaFree(deviceData); 
   cudaFree(deviceQueries);

  // Index in current grid line (y-dimesnion) for every query computation                          
  unsigned int query_ind = threadIdx.x + blockIdx.y*D;

/*
  unsigned int i = blockIdx.x*blockDim.x*blockDim.y + 
                   threadIdx.y*blockDim.x + threadIdx.x;
*/

  // Save the difference in the appropriate possition.
  double tmp = 0;

    max_iterations++;
  }

//  printf("Max iterations %d\n", max_iterations);
  int offset;

  for (int iter = 0; iter < max_iterations; ++iter) {
