Both the House and Senate have officially passed a set of 12 spending bills, bringing the government one step closer to avoiding a repeat of last year’s holiday shutdown. The bills, approved as part of two packages, now head to President Donald Trump’s desk, where he is poised to sign the legislation, according to White House adviser Kellyanne Conway.

This progress is significant: Right around this time last year, Congress failed to keep the government funded due to Trump’s demands for his border wall and the country ultimately endured the longest shutdown the US has ever experienced.

While there were some hiccups along the way, House and Senate lawmakers were able to reach an agreement ahead of the funding deadline at the end of this week, in order to prevent that scenario from playing out again.

The deal that they’ve landed on includes a total of $1.37 trillion in funding for agencies like the Department of Homeland Security, as well as Congress itself. These bills would keep the government funded though the end of September 2020. They also allocate $1.375 billion for border barriers, the same amount that was designated to fencing in last year’s spending bills.

In other notable additions, Democrats secured $25 million in funding for gun violence research (the first funds Congress has put behind the subject in roughly two decades), $425 million for election security grants and an additional $550 million for federal child-care grants. Legislative riders include a measure that raises the age for purchasing tobacco products from 18 to 21 and another that extends Medicaid funding to US territories, including Puerto Rico.

Pending potential interference from Trump, who forced the government shutdown last year, lawmakers are on track to keep the government open as Congress adjourns for the holiday recess.

The shutdown loop, explained

The ongoing will-they-won’t-they dynamic surrounding government shutdowns is a relatively recent one that began in the 1980s. At the time, then-Attorney General Benjamin Civiletti developed a new interpretation of the Antideficiency Act, a law that effectively banned the government from using funds that have not been appropriated by Congress, forcing it to shut down if it’s not given the money to keep on operating.

Prior to 1980, government officials believed the law meant that agencies could stay open even during funding gaps so long as they curbed their expenditures. As Vox’s Dylan Matthews has explained, the first few shutdowns didn’t actually mean the federal government ground to a halt. Civiletti, however, issued two opinions establishing that agencies needed to broadly cease operations when funding hadn’t been approved, unless it was absolutely necessary for them to keep working.

Since then, the US government has shut down 15 times, including last year. There are a couple of different reasons this keeps on happening.

While spending bills are seen as a must-pass item in Congress, they’re also subject to lawmakers’ habit of procrastinating on legislation until the last minute. As partisanship has grown, they’ve increasingly been treated as leverage in political fights, including when Trump used his demands for a border wall to hold up passage of a funding bill. (It’s worth noting that his efforts were ultimately unsuccessful and that he had to declare a national emergency to get the funds he wanted.) Despite the fallout they cause, politicians haven’t historically been penalized for shutdowns at the ballot box, meaning they aren’t deterred from engaging in them again.

This year, Congress seems focused on avoiding the outcome it experienced last year, with a goal of maintaining government operations and ensuring that federal workers and contractors continue to get paid.