diff --git a/omp_bucket b/omp_bucket
index 3e93d270673fe4e6d72f69658e25c67a55e92982..b8fe71755b7603d043237b5569c3b025da603d1a 100755
Binary files a/omp_bucket and b/omp_bucket differ
diff --git a/omp_bucket.c b/omp_bucket.c
index f176507dc983a992ff09e791dfe1592d62932ca1..edaebd1f54500abf2f12daeb4bf7552f486d8971 100644
--- a/omp_bucket.c
+++ b/omp_bucket.c
@@ -56,15 +56,29 @@ int main(int argc, char *argv[]) {
 
 void insertion_sort(int* sorted_array, int size, int element_num)
 {
-  int n, array[size], c, d, t;
-
+  int n, c, d, t;
 
+  int interval;
   int my_rank = omp_get_thread_num();
   int thread_count = omp_get_num_threads();
-  n = thread_count+1;
+
+  interval = size;
+  // if there is remainder of thread then the last thread hold all the element
+  if ((element_num - thread_count * size) != 0){
+    if(my_rank == thread_count-1){
+      // printf("%d\n", my_rank );
+
+      size = element_num % thread_count + size;
+
+      // printf("%d\n", size);
+    }
+  }
+
+  int array[size];
 
   for (c = 0; c < size; c++) {
     array[c] = rand() % (size) + (my_rank)*size;
+    // printf("%d ", array[c]);
   }
 
   // Sorting
@@ -80,13 +94,13 @@ void insertion_sort(int* sorted_array, int size, int element_num)
     }
   }
 
-
+//   printf("Rank : %d\n", my_rank);
 //   for (c=0;c<size;c++){
-//     printf("%d",array[c]);
+//     printf("%d ",array[c]);
 //
 // }
   // printf("\nSize : %d\n", size);
-  memcpy(sorted_array+(my_rank * size), &array, size*sizeof(int));
+  memcpy(sorted_array+(my_rank * interval), &array, size*sizeof(int));
 }
 
 void bucket_sort(int* sorted_array, int element_num) {