What do countries that weathered the Great Recession better than others have in common? They got in better shape before the crisis struck.

Germany is one example. Reunification meant great opportunity for Germany, but it also meant a prolonged period of economic weakness. The fiscal and structural reforms lawmakers made in response continue to pay dividends to this day.

In the early 2000s, Germany embarked on a pro-growth deficit-reduction course coupled with structural labor market reforms. It lowered income taxes to improve growth and implemented critical labor market reforms to improve work incentives and boost manufacturing productivity.

To reduce the costs of its public pension program, it increased the statutory retirement age, eliminated early retirement clauses and changed the way it calculates pension payments. Germany also adopted cuts to public-sector pay (e.g., no more Christmas-related extra payments) and reduced subsidies for specific industries.

This approach gave Germany the strong foundation it needed to weather a worldwide economic slump that hit Europe particularly hard.

Across the globe, countries that followed this model—that kept their budgets in check and reformed entitlement programs before the Great Recession hit—emerged in better shape than countries that failed to enact necessary reforms, according to a new report from The Heritage Foundation.

“Countries that exercised fiscal responsibility and reformed entitlements before the Great Recession had far more policy flexibility during the crisis and were less likely to suffer a severe or prolonged slump,” said Salim Furth, the report’s main author.

The Heritage study looked at data on fiscal policy in Europe since 2007. It revealed a variety of lessons policymakers in Europe, the United States and elsewhere can benefit from.

During the recession, Germany benefitted from an alternative to expanded unemployment: Kurzarbeit. Kurzarbeit is a federal subsidy that makes up a portion of lost pay for workers whose hours are temporarily reduced  during cyclical reductions in demand. Its purpose is to encourage employers to retain trained staff so that production can recover more quickly in response to recovering demand.

By keeping workers on staff during the recession rather than laying them off, German producers could rapidly take advantage of rising demand when the global economy improved. Government intervention comes with costs and unintended consequences, but given the choice between expanding unemployment benefits or temporarily reducing worker’s hours, the latter proved successful within the German context.

Although large bailouts and stimulus efforts during the recession steeply increased Germany’s national debt, the country responded by adopting a Swiss-style debt brake and a spending-cut-heavy budget to get there, suggesting a commitment to control spending and debt moving forward.

The U.S., on the other hand, is on course to amass unsustainable debt, which according to the Congressional Budget Office “increases the risk of a fiscal crisis in which investors would lose so much confidence in the government’s ability to manage its budget that the government would be unable to borrow at affordable rates.”

Short of a debt-driven fiscal crisis, high debt also leaves the U.S. unprepared to respond to external shocks as “lawmakers would have less flexibility than they otherwise would to use tax and spending policies to respond to unexpected challenges.”

Although Germany faces headwinds—its economy is still less free than the United States and its demographic challenges are even more severe—the experience of the European powerhouse during the recession shows that preparation is key to weather crises.

To prepare the U.S. for the crises that lie ahead, lawmakers should control spending and the debt with entitlement reforms. The time to act is now, before the next crisis strikes.