WASHINGTON -- As House Speaker John Boehner (R-Ohio) briefed his conference on the broad strokes of a government funding bill, aides behind the scenes were still hammering out actual language and details, reaching a deal at about 10:30 p.m., a senior Senate leadership aide told reporters.

The aide said negotiators from the House Republicans, Senate Democrats and the White House met for a final time Friday evening, finally agreeing to a figure of roughly $38 billion. Each side made some final concessions: Democrats agreed to add half a billion dollars in additional cuts to mandatory spending, while Republicans agreed that no language related to Planned Parenthood and Title X funding would be in the short-term funding bill.

They finished negotiations only an hour and a half before government funding expired. If one chamber had not moved by about 11 p.m., the government would have begun to shut down, the aide said.

And yet, there remained some disputes, including over the actual size of the overall cuts. While Boehner's office was talking about $38.5 billion in cuts, Brian Fallon, a spokesman for Sen. Chuck Schumer (D-N.Y.) said in an email that the total is "definitely 37.7 billion." Boehner's office could not immediately explain the difference in figures.

On the particulars, too, who actually got the best of the battle was a topic of disagreement. While Boehner's office triumphantly blasted around a fact sheet on all the policy changes and spending cuts it secured, Democratic aides insisted they didn't get a raw deal.

One top aide noted that of the cuts the party agreed to, $17 billion came from mandatory as opposed to discretionary spending. Why was that significant? Because when the debate shifts to the 2012 budget, the baseline numbers lawmakers consider for those mandatory programs revert back to their previous levels. (Had all the cuts been to discretionary spending, it would have had longer-term implications).

Federal funding for health care reform implementation and Planned Parenthood were major sticking points, all sides acknowledged. GOP aides originally said the language to block subsidies for Planned Parenthood was non-negotiable, only to back down when the president and Reid said the bill could go down over that issue. Republican leadership responded by suggesting that it would support putting that rider in the bill while granting Senate Democrats the option of voting it out, a Democratic aide relayed. Instead, they got the inverse. The Planned Parenthood rider would be kept out of the bill, with Republicans getting the option to add it in via a vote in the Senate.

Other abortion riders -- such as one involving the Mexico City Policy, which requires all non-governmental organizations that receive federal funding to refrain from performing abortions -- were either removed or watered down. The one that remained, outlawing federal funds from being used for abortions in D.C., was a "tough" pill to swallow, the Democratic aide acknowledged. But it would only last for five months, until the end of the continuing resolution, and in the end, that measure was cleared with Senate Democratic abortion-rights advocates such as Barbara Boxer (D-Calif.) and Patty Murray (D-Wash.) before it was inserted into the final legislative language.

The handling of negotiations was as scrutinized as the actual language. Reid, the leadership aide said, was careful in picking his moments to speak up. One of his main contributions was to ask Boehner if it would move the process along to have the Senate hold another test vote on H.R. 1, the House-passed funding bill that failed in the Senate last month, to show House Republicans that their bill was a non-starter in the upper chamber.

President Barack Obama, meanwhile, became more forceful as negotiations went on, the aide said, growing frustrated as Boehner refused to name specific figures for his desired spending cuts.

One low point came on Wednesday evening, when talks broke down over all major aspects of the deal. The likelihood of reaching a compromise was pegged by Democratic officials at less than 20 percent. House Republicans set certain policy riders as a priority, including language over Guantanamo Bay, the Environmental Protection Agency and financial-system oversight.

Over time, they walked away from that demand, trading votes on Planned Parenthood and health care reform funding for audits on aspects of health care and financial regulatory reform. A rider relating to EPA language was removed from the bill, after Democrats said the issue had already been decided in a congressional vote held earlier this week. House Republican language blocking funding for National Public Radio and net neutrality were also axed.

Some funding cuts were found by taking $2.5 billion from transportation appropriations, which the aide said had not yet been appropriated. Others were kept by keeping Pentagon funds at $513 billion -- Republicans wanted the level raised to $514 billion. Even more were found by refiguring Obama's signature health care law, such as $3 billion that was taken from funds to establish insurance cooperatives.

The short-term funding bill, meant to give negotiators time to finalize work on the longer extension, passed through the House and Senate by about 12:30 a.m.. It includes $2 billion of the cuts from the final package, matching the House GOP's rate of cuts for previous continuing resolutions.