   uint threads = SMALL_SIZE / 2;
    
   tsortSmall<<<blocks, threads,4096>>>(d_data, d_data);
-
-  for(int i = 0 ; i < diff ; i += 1){
-  
-    for(int j = i; j >= 0; j -= 1){ //Always true for uint
+  //cudaThreadSynchronize();
+  
+  for(int i = 0 ; i <= diff ; i += 1){ /*I made it <= and now it sorts? */
+  
+    for(int j = i; j >= 0; j -= 1){ 
       cSwap<<<blocks/2,threads*2,0>>>(d_data, d_data,(1<<j)*SMALL_SIZE);
       
-      // cudaThreadSynchronize();
+      //  cudaThreadSynchronize();
     }
                 
     tmergeSmall<<<blocks,threads,4096>>>(d_data, d_data);
-    
+    //cudaThreadSynchronize();
   }
 }
 


    int v1 = d_input[ix];
    int v2 = d_input[ix + stride];
   
    d_output[ix] = min(v1,v2);
    d_output[ix + stride] = max(v1,v2);
  

  cudaMemcpy(result, dvalues, sizeof(int) * LARGE_SIZE , cudaMemcpyDeviceToHost);
  cudaFree(dvalues);
 
  /* Results ?*/
  int passed = 1;
  for (int i = 1; i < LARGE_SIZE; ++i) { 
