After eight years and roughly $330 billion in loans, Greece is putting bailouts behind it.

The country on Monday officially exited the last of the three enormous rescue programs that saved it from going bust and abandoning the euro. But the bailouts from the International Monetary Fund, the European Central Bank and the European Commission came at a huge cost that will still be felt for years to come.

In exchange for the money, Greece agreed to drastically cut spending and implement painful economic reforms. Government employees had their salaries slashed, their pensions frozen, and their retirement age pushed higher. Consumer spending plummeted, unemployment spiked and many businesses shut down.

The Greek economy is now three-quarters of the size it was in 2007, before the crisis started. And it still faces a range of challenges.

On paper, the government, whose runaway spending fueled the financial meltdown, has put its house in order. It went from a 15% budget deficit in 2009 to a 1% surplus in 2017.

"Greece is ready to exit. It has done most of the hard adjustment work [and] its economy is finally expanding again at a half-satisfactory pace," said Holger Schmieding, chief economist at Berenberg Bank.

You did it! Congratulations to Greece and its people on ending the programme of financial assistance. With huge efforts and European solidarity you seized the day. — Donald Tusk (@eucopresident) August 20, 2018

The Greek economy is expected to grow 2% this year and 2.4% next year, after shrinking for eight out of the past 10 years. Public debt is forecast to peak this year at over 188% of GDP before declining to 151% by 2023, the year Greece is due for another review and possible debt relief.

Economic health remains elusive

Crucially, the cost of borrowing has come down.

"The bailouts have achieved their objective — to restore a degree of investor confidence and market access," said Mujtaba Rahman, Eurasia Group's managing director for Europe. "Greece can access capital markets and raise money itself."

The country's creditors have also agreed to restructure its debts, making it possible for the government to manage future payments.

But plenty of problems remain.

"There's a range of structural economic issues that haven't been resolved through the program, despite the supervision during the past eight years," Rahman said. "I think it's a stretch to call the program a success. It hasn't restored economic health."

IMF Managing Director Christine Lagarde cautioned last month that "greater reform efforts remain key to an economic recovery and lasting growth."

She said the Greek government still needs to improve how it collects taxes, do a better job of clearing out unqualified civil servants and urgently revamp its privatization program.

"Public debt is projected to remain high well into the next decade," Lagarde said, adding that the promise of continued support from Greece's main European creditors "remains essential."

A decade of pain

Greece was hit hard by the global financial crisis in 2008. The country was already heavily indebted after years of government overspending, but the credit crunch made its finances unsustainable.

Because Greece uses the euro as its currency, the spiraling debt crisis put the whole eurozone at risk. If Greece were to drop out of the single currency bloc, it would undermine investors' confidence in the entire project.

The euro was hit by the uncertainty, and Europe was forced to act. The first bailout came in 2010. The IMF, the ECB and the European Commission announced a three-year aid package, designed to rescue Greece.

The second package came in 2012.

The pain was made worse in 2015 after the populist Syriza party won national elections on the promise to end the austerity. The party's leader, Alexis Tsipras, became prime minister and went on the offensive against the country's creditors.

Related: What happens next in Turkey? It probably won't be good

Tsipras alarmed investors by calling a referendum on the austerity measures, in which voters rejected more reforms. But just a few weeks later, he was forced to capitulate and ask Europe for more money.

A third bailout package was agreed, but the IMF did not contribute funds. The total loans dispersed over three bailouts was €288 billion ($330 billion).