public function exec($maxRequests = null, $retryCount = 0, $retryWait = 0, $waitBetweenChunks = 0)
    {
        if ($maxRequests == null or $maxRequests <= 0) {
            $this->subExec($this->curlInstances, $retryCount, $retryWait);
            return;
        }

        $instanceChunks = array_chunk($this->curlInstances, $maxRequests, true);

        foreach ($instanceChunks as $index => $instances) {
            $this->subExec($instances, $retryCount, $retryWait);

            // Wait for the given time if this is not the last chunk (to only wait between chunks)
            if ($index != count($instanceChunks) - 1) {
                sleep($waitBetweenChunks);
            }
        }
    }