Putting aside lingering hostilities from nearly 50 years of civil war, Sudan and South Sudan have agreed to share profits tied to oil exports from the region that were halted earlier this year.

The agreement, which came after four days of negotiations in the Ethiopian capital of Addis Ababa, includes a provision to establish border security between the two countries, which nearly went to war a few months ago in an ongoing dispute over certain oil-rich areas. The deal, which was to be signed Thursday, reportedly provides for a demilitarized buffer zone between both countries, but does not resolve who will eventually end up with control of several disputed borderlands.