public static double[][] calculcateDistanceMatrix(Map imagesTags, ArrayList<String> representativeTags) {

        /* Initialise matrix with amountTags * amountTags; right now only a tenth! */
        int amountTags = imagesTags.size();
        int poolSize = amountTags / TEST_POOL_SIZE_DIVISION;

        /* Change blocking queue to blocking queue with poolSize tasks */
        blockingQueue = new ArrayBlockingQueue<Runnable>(poolSize);

        /* Load all tags in map */
        ArrayList<String> tagpool = createTagPool(imagesTags);

        if (PRINT == 1)
            System.out.println(tagpool);

        /* Multithreading */
        executor.prestartAllCoreThreads();

        /* Calculate a map with the tags and their corresponding histogramm, see global variable histogramms */
        for (int i = 0; i < poolSize; i++) {
            executor.execute(new CoocurrenceHistogramm(i, tagpool, imagesTags, representativeTags));
        }

        executor.shutdown();

        while (!executor.isTerminated()) {
        }
        // System.out.println("Calculation of Coocurrences done!");

        // Set distanceMatrix size
        distanceMatrix = new double[poolSize][poolSize];
        blockingQueue = new ArrayBlockingQueue<Runnable>((poolSize * poolSize) / 2);
        executor = new ImageSignatureThreadPoolExecutor(CORE_POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.NANOSECONDS, blockingQueue);
        executor.prestartAllCoreThreads();

            /* Go through those histogramms and calculate Jenson-Shanon-Divergence for each pair */
        for (int i = 0; i < poolSize; i++) {
            System.out.print(i + ", ");
            for (int i2 = i + 1; i2 < poolSize; i2++) {
                try {
                    executor.execute(new DivergenceHistogramms(histogramms.get(i), histogramms.get(i2), i, i2));
                } catch (Exception e) {
                    System.out.println("i:" + i + "; i2:" + i2 + "; amountTags/TEST_POOL_SIZE_DIVISION :" + poolSize);
                    System.exit(-1);
                }

            }
        }

        executor.shutdown();

        while (!executor.isTerminated()) {
        }
        // System.out.println("Calculation of Divergence done!");

        System.out.println("");
        writeDistanceMatrixIntoFile(distanceMatrix);

        return distanceMatrix;

    }