function _farmPlots(address _sender) internal {
    (
        address mainAccount,
        MunchablesCommonLib.Player memory renterMetadata
    ) = _getMainAccountRequireRegistered(_sender);

    uint256[] memory staked = munchablesStaked[mainAccount];
    MunchablesCommonLib.NFTImmutableAttributes memory immutableAttributes;
    ToilerState memory _toiler;
    uint256 timestamp;
    address landlord;
    uint256 tokenId;
    int256 finalBonus;
    uint256 schnibblesTotal;
    uint256 schnibblesLandlord;
    for (uint8 i = 0; i < staked.length; i++) {
        timestamp = block.timestamp;
        tokenId = staked[i];
        _toiler = toilerState[tokenId];
        if (_toiler.dirty) continue;
        landlord = _toiler.landlord;
        // use last updated plot metadata time if the plot id doesn't fit
        // track a dirty bool to signify this was done once
        // the edge case where this doesn't work is if the user hasn't farmed in a while and the landlord
        // updates their plots multiple times. then the last updated time will be the last time they updated their plot details
        // instead of the first
        if (_getNumPlots(landlord) < _toiler.plotId) {
            timestamp = plotMetadata[landlord].lastUpdated;
            toilerState[tokenId].dirty = true;
        }
        // existing code...
    }
    // existing code...
}
struct PlotMetadata {
    uint256[] updateTimestamps;
    uint256 currentTaxRate;
}
function _reconfigure() internal {
    // existing code...
    plotMetadata[landlord].updateTimestamps.push(block.timestamp);
    // existing code...
}
function _farmPlots(address _sender) internal {
    // existing code...
    for (uint8 i = 0; i < staked.length; i++) {
        // existing code...
        if (_getNumPlots(landlord) < _toiler.plotId) {
            uint256 correctTimestamp = _getCorrectTimestamp(landlord, _toiler.lastToilDate);
            timestamp = correctTimestamp;
            toilerState[tokenId].dirty = true;
        }
        // existing code...
    }
    // existing code...
}

function _getCorrectTimestamp(address landlord, uint256 lastToilDate) internal view returns (uint256) {
    uint256[] memory timestamps = plotMetadata[landlord].updateTimestamps;
    for (uint256 i = 0; i < timestamps.length; i++) {
        if (timestamps[i] > lastToilDate) {
            return timestamps[i];
        }
    }
    return block.timestamp; // fallback to current timestamp if no match found
}
struct PlotMetadata {
    mapping(uint256 => uint256) updateTimestamps;
    uint256 currentTaxRate;
}
function _reconfigure() internal {
    // existing code...
    plotMetadata[landlord].updateTimestamps[plotId] = block.timestamp;
    // existing code...
}
function _farmPlots(address _sender) internal {
    // existing code...
    for (uint8 i = 0; i < staked.length; i++) {
        // existing code...
        if (_getNumPlots(landlord) < _toiler.plotId) {
            uint256 correctTimestamp = plotMetadata[landlord].updateTimestamps[_toiler.plotId];
            timestamp = correctTimestamp;
            toilerState[tokenId].dirty = true;
        }
        // existing code...
    }
    // existing code...
}
struct Snapshot {
    uint256 timestamp;
    uint256 taxRate;
}
struct PlotMetadata {
    Snapshot[] snapshots;
}
function _reconfigure() internal {
    // existing code...
    plotMetadata[landlord].snapshots.push(Snapshot({
        timestamp: block.timestamp,
        taxRate: currentTaxRate
    }));
    // existing code...
}
function _farmPlots(address _sender) internal {
    // existing code...
    for (uint8 i = 0; i < staked.length; i++) {
        // existing code...
        if (_getNumPlots(landlord) < _toiler.plotId) {
            Snapshot memory correctSnapshot = _getCorrectSnapshot(landlord, _toiler.lastToilDate);
            timestamp = correctSnapshot.timestamp;
            toilerState[tokenId].dirty = true;
        }
        // existing code...
    }
    // existing code...
}

function _getCorrectSnapshot(address landlord, uint256 lastToilDate) internal view returns (Snapshot memory) {
    Snapshot[] memory snapshots = plotMetadata[landlord].snapshots;
    for (uint256 i = 0; i < snapshots.length; i++) {
        if (snapshots[i].timestamp > lastToilDate) {
            return snapshots[i];
        }
    }
    return Snapshot({timestamp: block.timestamp, taxRate: 0}); // fallback to current state if no match found
}
