         // copies the device vector back to the host
         std::vector<Board> stl_vector(d_vec.size());
         thrust::copy(d_vec.begin(), d_vec.end(), stl_vector.begin());
-        
-        for (int i = 0 ; i < stl_vector.size() ; i++ ) {
-            print_board(&stl_vector[i], x_max, y_max);
-        }
-
-        exit(1);
-
-        qsort(output, outCount, sizeof(Board), compare_boards);
-        CUDA_CHECK_ERROR();
-
-        LOG_PRINTF("sorting done...\n");
-        Board *noDuplicates = new Board[outCount];
-        int dupCount = 1;
-
-        Board last = output[0];
-        memcpy(&noDuplicates[0], &output[0], sizeof(Board));
-        
-        for (int i = 1 ; i < outCount ; i++) {
-            if (is_valid(&output[i])) {
-                if (!boards_equal(&last, &output[i])) {
-                    memcpy(&noDuplicates[dupCount++], &output[i], sizeof(Board));
-                    last = output[i];
-                }
-            } else {
-                break;
-            }
-        }
-        
-        LOG_PRINTF("duplicate count : %d\n", dupCount);
-        delete[] output;
-
-        int size = 3000000;
-        if (dupCount > size) {
-            LOG_PRINTF("\n");
-            
+     
+        h_vec.clear();
+        h_vec.shrink_to_fit();
+        d_vec.clear();
+        d_vec.shrink_to_fit();
+
+        LOG_PRINTF("actual size     : %d\n", stl_vector.size()); 
+
+        int size = 1000000;
+        int outSize = stl_vector.size();
+        if (outSize > size) {
             LOG_PRINTF("splitting...\n");
-
-            work_down(noDuplicates, x_max, y_max, size, !vertical, depth + 1);
-            /*for (int i = 0 ; i < dupCount ; i += size) {
-                if (dupCount < i + size) {
-                    work_down(noDuplicates + i, x_max, y_max, dupCount - i, !vertical, depth + 1);
+            for (int i = 0 ; i < outSize ; i += size) {
+                if (outSize < i + size) {
+                    work_down(&stl_vector[i], x_max, y_max, outSize - i, !vertical, depth + 1);
                 } else {
-                    work_down(noDuplicates + i, x_max, y_max, size, !vertical, depth + 1);
-                }
-            }*/
+                    work_down(&stl_vector[i], x_max, y_max, size, !vertical, depth + 1);
+                }
+            }
+
         } else {
-            work_down(noDuplicates, x_max, y_max, dupCount, !vertical, depth + 1);
-        }
-        delete[] noDuplicates;
+            work_down(&stl_vector[0], x_max, y_max, stl_vector.size(), !vertical, depth + 1);
+        }
     } else { 
         LOG_PRINTF("no more moves\n");
         delete[] output;

        Board board = (Board) output[i];
        if (is_valid(&board) == true) {
            next = true;
            print_board(&board, x_max, y_max);
            break;
        }
    }
    
    CUDA_SAFE_CALL(cudaFree(dev_input));
    CUDA_SAFE_CALL(cudaFree(dev_output));
    
    if (next) {
        


// main routine that executes on the host
int main(void) {
    unsigned char x = 7;
    unsigned char y = 7;

    std::set_new_handler(outOfMemHandler);

