     }
 }
 
-func equalizeHistogram(_ iterationsHistogram: [Int], _ maxIterations: Int) -> [Float] {
+func equalizeHistogram(_ iterationsHistogram: [Int32], _ maxIterations: Int) -> [Float] {
     // Calculate the CDF (Cumulative Distribution Function) by accumulating all iteration counts.
     // Element [0] is unused and iterationsHistogram[maxIterations] should be zero (as we do not count
     // the iterations of the points inside the Mandelbrot Set).

    return PixelColor(r: 0, g: 0, b: 0)
}

func mandelbrotCalc(_ imageWidth: Int, _ imageHeight: Int, _ maxIterations: Int, _ centerX: Double, _ centerY: Double, _ height: Double, _ iterationsHistogram: inout [Int], _ resultsPerPoint: inout [CalculationResult]) {
    let width = height * (Double(imageWidth) / Double(imageHeight))

    let xLeft   = centerX - width / 2.0

    return cdf.map { $0 > 0 ? f * Float($0 - cdfMin!) : 0.0 }
}

func mandelbrotColorize(_ imageWidth: Int, _ imageHeight: Int, _ maxIterations: Int, _ gradient: Gradient, _ imageData: inout [PixelColor], _ iterationsHistogram: [Int32], _ resultsPerPoint: [CalculationResult]) {
    let equalizedIterations = equalizeHistogram(iterationsHistogram, maxIterations)

    for (pixel, calcResult) in resultsPerPoint.enumerated() {
