public SimulationResult performSimulation(int numberOfThreads) throws InterruptedException {
        if (numberOfThreads <= 0) {
            throw new IllegalArgumentException("Number of threads must be positive.");
        }
        if (numberOfThreads > 16) {
            throw new IllegalArgumentException("A maximum of 16 threads are allowed.");
        }
        if (numberOfThreads == 1) {
            return performSimulation();
        }

        SimulationResult simulationResult;
        Set<AbstractStartingHand> handSet = new HashSet<AbstractStartingHand>(startingHands);

        if (gameType.isCommunityCardGame()) {
            simulationResult = new SimulationResult(handSet, board, numberOfSimulations, gameType);
        } else {
            simulationResult = new SimulationResult(handSet, numberOfSimulations, gameType);
        }
        int simulationsPerThread = numberOfSimulations / numberOfThreads;
        int remainder = numberOfSimulations - (numberOfThreads * simulationsPerThread);

        List<HandSimulationThread> threadList = new ArrayList<HandSimulationThread>();

        HandSimulationThread threadToAdd = new HandSimulationThread(this, simulationResult, simulationsPerThread + remainder);
        threadList.add(threadToAdd);

        for (int i = 1; i < numberOfThreads; i++) {
            threadToAdd = new HandSimulationThread(this, simulationResult, simulationsPerThread);
            threadList.add(threadToAdd);
        }

        for (HandSimulationThread thread : threadList) {
            thread.start();
        }

        for (HandSimulationThread thread : threadList) {
            thread.join();
        }

        return simulationResult;

    }