diff --git a/src/lib/bitonic_sort.cu b/src/lib/bitonic_sort.cu
index 6f2d2a3e508782bc2022b1972425ac9b342bcb4c..7b8c1816c29580c4435b1a3bfccf7e373dd731ad 100644
--- a/src/lib/bitonic_sort.cu
+++ b/src/lib/bitonic_sort.cu
@@ -104,8 +104,7 @@ void copy_padding(int *dest, int *src, int length, int length_buffer)
 int minimum_blocks(int length, int num_threads) {
   int num_blocks = 1;
 
-  // Increase the number of blocks 2 times 
-  // until the number of threads is less than the length of the array.
+  // Increase the number of blocks 2 times, so it will be a power of 2.
   while (num_blocks * num_threads < length) {
     num_blocks *= 2;
   }
@@ -123,10 +122,11 @@ int minimum_blocks(int length, int num_threads) {
 __global__ void bitonic_sort_step(int *d_arr, int i, int j)
 {
   // The array index and its patner.
-  unsigned int idx, patner;
-  idx = threadIdx.x + blockDim.x * blockIdx.x;
+  int idx, patner;
 
-  // Get the patner.
+  // The thread index.
+  idx = threadIdx.x + blockDim.x * blockIdx.x;
+  // The thread index of the patner.
   patner = idx ^ j;
 
   // Sort the array by threads with the lowest idx.