   // left border from bottom to top
   destination[imageSize * 3 + index] =
       source[maxIndex - imageSize + 1 - index * imageSize];
-
-  /*const int yp1 = index / imageSize;
-  const int xp1 = index - yp1*imageSize;
-  const int yp2 = ((imageSize-1) + index*imageSize) / imageSize;
-  const int xp2 = ((imageSize-1) + index*imageSize) - yp2*imageSize;
-  const int yp3 = (maxIndex - index) / imageSize;
-  const int xp3 = (maxIndex - index) - yp3*imageSize;
-  const int yp4 = (maxIndex - imageSize + 1 - index*imageSize) / imageSize;
-  const int xp4 = (maxIndex - imageSize + 1 - index*imageSize) -
-  yp4*imageSize;
-  printf("%d: %d %d, %d %d, %d %d, %d %d\n", index, xp1, yp1, xp2, yp2, xp3,
-  yp3, xp4, yp4);*/
-
-  //__syncthreads();
-  /*if ((destination[index] == 0) || (destination[imageSize + index ] == 0) ||
-  (destination[imageSize*2 + index] == 0) || (destination[imageSize*3 + index]
-  == 0))
-  {
-    printf("buffer is 0: %d: %d %d %d %d \n", index, destination[index],
-  destination[imageSize + index], destination[imageSize*2 + index],
-  destination[imageSize*3 + index] );
-    const int yp1 = index / imageSize;
-    const int xp1 = index - yp1*imageSize;
-    const int yp2 = ((imageSize-1) + index*imageSize) / imageSize;
-    const int xp2 = ((imageSize-1) + index*imageSize) - yp2*imageSize;
-    const int yp3 = (maxIndex - index) / imageSize;
-    const int xp3 = (maxIndex - index) - yp3*imageSize;
-    const int yp4 = (maxIndex - imageSize + 1 - index*imageSize) / imageSize;
-    const int xp4 = (maxIndex - imageSize + 1 - index*imageSize) -
-  yp4*imageSize;
-    printf("values: %d: %d %d, %d %d, %d %d, %d %d\n", index, xp1, yp1, xp2,
-  yp2, xp3, yp3, xp4, yp4);
-  }*/
 }
 
 Apollonius::Apollonius(std::shared_ptr<CudaArrayProvider> distancesImage,

    {
      if (extractedIndices.insert(uniqueIndex).second)
      {
        std::cout << "Extracted index: " << uniqueIndex << std::endl;
        insertionOrder.push_front(pixelIndexToLabelId[uniqueIndex]);
      }
    }

      orderedIndicesPtr);

  HANDLE_ERROR(cudaThreadSynchronize());

  thrust::device_vector<int>::iterator it_found =
      thrust::unique(orderedIndices.begin(), orderedIndices.end());
  thrust::host_vector<int> uniqueIndices(orderedIndices.begin(), it_found);
