```\nfunction process(uint256 gas) public returns (uint256, uint256, uint256)\n{\n    uint256 numberOfTokenHolders = tokenHoldersMap.keys.length;\n\n    if (numberOfTokenHolders == 0 || dividendsPaused) {\n        return (0, 0, lastProcessedIndex);\n    }\n\n    uint256 _lastProcessedIndex = lastProcessedIndex;\n\n    uint256 gasUsed = 0;\n\n    uint256 gasLeft = gasleft();\n\n    uint256 iterations = 0;\n    uint256 claims = 0;\n\n    while (gasUsed < gas && iterations < numberOfTokenHolders) {\n        _lastProcessedIndex++;\n\n        if (_lastProcessedIndex >= numberOfTokenHolders) {\n            _lastProcessedIndex = 0;\n        }\n\n        address account = tokenHoldersMap.keys[_lastProcessedIndex];\n\n        if (!excludedFromAutoClaim[account]) {\n            if (processAccount(payable(account), true)) {\n                claims++;\n            }\n        }\n\n        iterations++;\n\n        uint256 newGasLeft = gasleft();\n\n        if (gasLeft > newGasLeft) {\n            gasUsed = gasUsed.add(gasLeft.sub(newGasLeft));\n        }\n\n        gasLeft = newGasLeft;\n    }\n\n    lastProcessedIndex = _lastProcessedIndex;\n\n    return (iterations, claims, lastProcessedIndex);\n}\n```\n