Both chambers of Nigeria’s parliament have passed a bill that overhauls nearly every aspect of the country's oil and gas production, putting a project that has been in the works for two decades one step closer to presidential sign-off.

Legislators have been hashing out details of the bill since President Muhammadu Buhari presented an initial version in September last year, but an overhaul has been in the works for some 20 years.

The chambers had been expected to vote clause by clause on the more than 400-page long report, but instead quickly approved the full package.

Each chamber made changes before approving the package, and the senate lowered the share of money for oil-producing communities. The chambers will need to meet again to work out the details, but members were optimistic that they would come to an agreement next week, after which it could go for presidential sign-off.

Analysts say its approval is essential to attracting a shrinking pool of capital for fossil fuel development.

Earlier in the day, senators entered a closed-door session with the petroleum minister and the head of state oil company NNPC for a briefing on the technical terms and details.

The last key controversies related to the share of wealth for communities in areas where petroleum is produced, and those in the northern and central parts of Nigeria where there is exploration but no production yet.

The house bill signed off on an increase in the share of regional oil wealth generated from production that host communities can claim from 2.5% to 5%, but the senate approved 3%. Communities had pushed for a 10% share.

Sources said disagreements with northern leaders were managed separately following several hours-long sessions between them and federal government officials early this week.

The package also includes a string of changes sought by oil majors, including amended royalties and fiscal terms for oil and gas production, and the transfer of state oil company NNPC’s assets and liabilities to a limited liability corporation created by the bill. It also divided the stakes in the new NNPC Ltd. evenly between the finance and petroleum ministries, but would not allow for public share sales without further government approval.

Leaders agreed earlier this year to sweeten the terms for oil companies in an effort to attract much-needed investment in an era of shrinking global cash for fossil fuel production.