A complex $26 billion global deal is forging ahead after months of negotiations that will distribute money this year to thousands of cities, counties and states struggling with the nation’s opioid crisis. But the process of doling out the deal’s nearly $2.3 billion in attorney fees and costs has just begun.

Settlement documents totaling 800 pages outline a complicated mix of attorney compensation that include a common benefit fund, contingency fees and payments to states with outside counsel. The total amount for lawyers had a ceiling; the deal’s provisions required that no less than 85% of the funds go toward opioid remediation.