Raul Castro took over a country in 2008 where most people couldn't own computers or cellphones, leave without permission, run most types of private businesses or enter resort hotels.

Castro set about re-engineering the system he had helped create and Cuba opened dramatically over his decade in office. But when Castro steps down after two terms as president in a legislative session state media says will take place on Wednesday, he will leave his successor a host of problems that are deeper than on the day his brother Fidel formally handed over power.

Cuba has nearly 600,000 private entrepreneurs, more than five million cellphones, a bustling real estate market and one of the world's fastest-growing airports. Limited internet use is expanding fast, with thousands of Cubans installing new home connections this year. Foreign debt has been paid.

On the other side of the ledger, Cuba's Soviet-style command economy still employs three of every four Cuban workers but produces little. Private sector growth has been largely frozen. The average monthly state salary is $31 — so low that workers often live on stolen goods and handouts from relatives overseas. Foreign investment remains anemic and the island's infrastructure is falling deeper into disrepair.

Castro's successor will have to manage the delicate relationship with Cuba's prosperous exiles at a time when relations with the U.S. have dropped from an unprecedented high under former president Barack Obama to a deep low under current President Donald Trump.

The break with Washington dashed dreams of detente with the U.S., and after two decades of getting Venezuelan subsidies totalling more than $6 billion a year, Cuba's patron has collapsed economically with no replacement in the wings.

Encourage entrepreneurship, resident says

Castro's inability or unwillingness to fix Cuba's structural problems with deep and wide-ranging reforms has many wondering how a successor without Castro's founding father credentials will manage the country over the next five or 10 years.

"People in Cuba really haven't processed yet what it means to have a government without Raul or Fidel leading it," said Yassel Padron Kunakbaeva, a prolific 27-year-old blogger who writes frequently from what he describes as a Marxist, revolutionary perspective. "We're entering unknown territory."

Workers stand behind their food stalls at a state-run market in Havana. The average monthly state salary of $31 is so low that some workers often live on stolen goods and handouts from relatives overseas. (Desmond Boylan/Associated Press)

Tens of thousands of highly educated professionals are abandoning the island each year, leaving Cuba with the combination of third-world economy and the demographics of a graying European nation. After a 2016 recession, Cuba said growth was 1.6 per cent last year, although official accounts remain opaque and questioned by experts. The single-party government controls virtually all forms of expression and organization, with near-zero tolerance of public criticism or dissent. The mood on the street is pessimistic, with few expecting a better future anytime soon.

"The political future of whoever takes over in April depends on the economic question," said Jose Raul Viera Linares, a former first deputy minister of foreign affairs. "It's the possibility for young people to dream, to design their own future. That's all based in the material wealth that this country is able to achieve."

The greatest immediate challenge for Castro's expected successor — 57-year-old Vice-President Miguel Diaz-Canel Bermudez — is unwinding a byzantine dual-currency system featuring one type of Cuban peso worth four cents and another that is nearly a dollar. The system was designed to insulate a state-run, egalitarian internal market using "national money" from trade with the outside world denominated in "convertible pesos."

Inefficient state enterprises receive mammoth subsidies by obtaining expensive convertible pesos for the price of the cheaper "Cuban peso." The dual-currency system also allows private businesses to receive subsidized goods and services like water and electricity in Cuban pesos, then turn around and charge their relatively wealthy clients in convertible pesos at a significant profit.

Raul Castro, who will remain first secretary of the Communist Party, the country's guiding body, has called for elimination of the dual currencies

Complex flow of people, remittances

In one of his final speeches last year he called once again for the system's urgent elimination, a process that many expect to start in Diaz-Canel's first year in power. Eliminating dual currency is widely seen as necessary for Cuba's economy to grow, but it carries risks of inflation and major disruption for inefficient state businesses whose subsidized balance sheets will finally become understandable when they are denominated in a single currency.

Those state businesses gained new competitors as Castro expanded the space for capitalism in the Cuban economy by permitting private enterprise in dozens of fields ranging from agriculture to hospitality to construction.

"We've risen up economically. The new possibilities have changed my life, of course," said Yanelis Garcia, a 44-year-old mother of three who saved money from raising pigs in her backyard to slowly build a prosperous six-room bed-and-breakfast and taxi business in the central city of Santa Clara. "I've always liked having my own business to be able to provide for my family. It's been really good."

A woman hangs a sign on her front door that reads in Spanish 'There's sandwiches' in Havana. Cuba has nearly 600,000 private entrepreneurs, but private growth stopped when the government froze new licences for private bed-and-breakfasts, restaurants and other popular businesses. (Desmond Boylan/Associated Press)

Cubans fill thousands of flights a year to Miami, Panama and Cancun, where they cram duffel bags with gym socks and Xboxes for the vibrant private sector and rising middle class. But last August, the Cuban government froze new licences for private bed and breakfasts, restaurants and other popular businesses, leaving many Cubans questioning how their government envisions a path to prosperity.

"We've seen necessary reforms and I think that in the future there will have to be more," said Norma Chiang, a 77-year-old state accountant and auditor. "Self-employment needs to be broadened, little things like bakeries or food stands that can be in the hands of individuals and not the state."

Cuba's next president also must find a way to make its economy grow while maintaining social stability and satisfying the millions of Cubans who depend on the state and a shrinking list of subsidized essentials sold in Cuban pesos for their survival.

"I can't eat, dress myself and live on $20 a month," said Adela Arpajon, a 54-year-old accountant for the Communist Party. "I either eat or buy clothes. It's hard, but that's the way it is."

The situation is complicated by Cuba's increasing economic dependence on the Cuban emigres.

As part of his broader immigration reforms, Raul Castro changed Cuba's relationship with its diaspora by allowing Cubans to maintain their rights to own property and receive social benefits as long as they return once every two years. That change fuelled the growth of a new class of Cubans who earn money overseas but invest at home and are responsible for hundreds of millions, if not billions, of dollars in small-scale investment on the island in recent years.

More than 20,000 Cuban emigres have "repatriated" and regained their property rights since the emigration reforms, according to Cuban figures. Still, the flow of emigres back to Cuba is swamped by the outward flood of Cubans unleashed by Castro's elimination of the hated exit permit known as the "white card."

According to U.S. Homeland Security statistics, the United States admitted 463,502 Cubans between 2006 and 2016, with tens of thousands more heading to countries such as Spain and Ecuador.