The US debt deal: A simple guide
The US has approved a deal to avoid defaulting on its debt.
The debt ceiling is the legal limit on the total amount of debt the US government can run up in order to pay its bills. Currently it is $14.3tn.
Political wrangling over the debt ceiling has caused much consternation in the financial markets and many will be happy that the deal has been done - even if the outcome pleases nobody.
So how does the deal work?
In the first instance, and perhaps most importantly as far as the markets are concerned, the deal immediately increases the debt ceiling by $400bn.
That gives the US the wiggle room to go on paying its bills - military salaries, interest on existing loans, Medicare, etc - in the short term.
The deal then raises the debt ceiling by another $500bn until February.
In principle, Congress can vote against this increase, but this is designed to be more of a political gesture and a symbolic rejection of the increase by conservatives in Congress.
President Barack Obama is expected to veto any such vote.
Decisions by committee
In the meantime, the deal puts in place measures to cut the US deficit by at least $2.1tn over 10 years.
From October, $917bn worth of spending cuts kicks in.
In November, a special joint committee of 12 people from the House of Representatives and the Senate comes back with its recommendations for up to $1.5tn in deficit reduction actions.
The panel cannot consider increasing taxes, it seems, but it can change the tax code to show additional revenues.
Congressional leaders are hopeful the compromise will win the backing of both houses, but some Republicans and Democrats in the House of Representatives remain opposed for different reasons.
By Christmas, Congress has to vote on the committee's plan - with no amendments allowed.
The idea is that the recommendations should be accepted.
If Congress rejects the plan, then a series of automatic spending cuts - thrashed out by Democrats and Republicans over the past few days - take effect.
The cuts are designed to make both sides balk - thereby forcing them in advance to consider seriously the committee's recommendations.
If the recommendations are rejected, cuts begin in January.
About half the spending cuts would come from defence, although Republican negotiators have managed to broaden the definition from just the military to other areas, such as the Department of Homeland Security.
Medicare - the US's federally-funded system of pensioner healthcare - would face some cuts, though healthcare for the poorest and pension payments would be spared cuts.
The last part of the deal also has to take place before the end of the year.
Both the House and Senate must hold a vote on adding a balanced budget amendment to the constitution - a rule requiring that future federal spending cannot exceed revenues.
To begin, this requires a two-thirds majority in both houses and is again seen as a political gesture on the part of fiscal conservatives ahead of an election year.
If the amendment does somehow pass, then Mr Obama can ask for a further increase in the debt ceiling of $1.5tn.
If the amendment does not pass, Mr Obama can request an increase of $1.2tn.
A key point for Mr Obama is that the bill would raise the debt ceiling into 2013, meaning he would not face another congressional showdown on spending in the middle of his re-election campaign next year.
All very straightforward, no?