When Theresa May formally invoked Article 50 of the Lisbon Treaty on Wednesday, it started the clock ticking: Unless all member states agree otherwise, Britain will leave the EU at the end of March 2019. The UK government has two years to disentangle the country from four decades of various laws, regulations, and institutions. It will be a staggeringly difficult task, affecting virtually every area of the economy and society.

Resolving any one of these challenges would, under normal circumstances, be difficult and politically fraught. Resolving them all simultaneously, within a two-year window, and while in parallel negotiating a new relationship, will be an undertaking on a scale like few others that have confronted British governments. The consequences of getting it wrong could be catastrophic.

While Westminster has been gripped in recent months by the process of withdrawing – and what sort of Brexit strategy the prime minister should pursue – officials across Whitehall have been preparing for the harder, more technical tasks ahead. Here, based on the government’s own publications, policy submissions by various interest groups, and dozens of hours of testimony to parliamentary select committees, as well as insight from a number of sources BuzzFeed News has spoken to over recent months, are some of the most pressing:

1. Negotiate a €50 billion divorce bill.

After leaving the EU, the UK will still have financial commitments that will need to be paid, and the European Commission’s chief negotiator, Michel Barnier, has made clear he wants this resolved before any talks about the future relationship begin. Europe wants to agree not a figure, but the principles and methodology for calculating it. May’s challenge: the more hawkish among British Eurosceptics, as well as much of the right-wing press, say we shouldn’t have to pay anything at all.

2. Reach agreement on the rights of 4 million people on both sides of the Channel.

The status of 3 million EU nationals living in Britain and a million Brits living elsewhere in the EU will be cast into doubt by Brexit; both the UK government and EU have said guaranteeing their rights (from residency to pensions) will be a priority in the early stages of the talks – but it will not be straightforward.

3. Determine transitional arrangements so that Britain avoids crashing over a cliff.

Most experts think the notion that Britain’s exit and future relationship can be dealt with in two years is for the birds. Both sides have hinted at an interim deal, although politically the UK government doesn’t like calling it “transition” (you can get stuck in transition for a long time). EU member states are firm: Britain can’t, even on a temporary basis, cherry-pick bits of membership without accepting all of the terms, the single market's four freedoms of movement (of goods, services, people, and capital) and its rules, which would force May to delay delivering on some of the political promises she has made to the Conservative party’s Eurosceptic right, including halting freedom of movement and ending the judicial oversight of the European Court of Justice. Negotiating an interim deal is a lot more complicated than simply extending talks; a negotiated agreement would have to be reached.

4. Strike a free trade deal with the EU.

Having ruled out membership of the single market as incompatible with the spirit of last summer’s referendum, May says she will seek a “comprehensive, bold, and ambitious” free trade agreement with the other 27 members to replicate the single market as closely as possible without aspects the UK finds unpalatable, such as the free movement of people. But Canada took seven years to negotiate an FTA with the EU – and that was small compared with the deal the UK will have to reach. It seems inevitable that trade won’t be as frictionless as it is now, despite ministers’ assertions: Businesses will face tariffs and numerous other barriers that they currently don’t under the single market.

5. Establish a new customs regime.

May has made it clear Britain will leave Europe’s customs union as well as the single market, so it can strike trade deals with other countries outside Europe. Businesses are concerned that new controls on moving goods in and out of the EU will result in delays and costly red tape.

6. Lay the groundwork for trade deals outside the EU.

May has already courted Donald Trump in the hope of reaching a quick UK–US deal; Britain will also look to strengthen ties with Commonwealth allies such as Australia and New Zealand. But trade deals typically take years to complete, and there’s a risk that rushed agreements will damage the economy in the long run. Whitehall’s negotiators, many of whom are still wet behind the ears because Britain hasn’t had to negotiate its own FTAs for 40 years, will face a hardened American administration that is increasingly protectionist.

7. Establish a new immigration system.

Ending free movement of people across borders is, for the prime minister, a red line. It’s unclear exactly what sort of migration controls May intends to put in place once Britain is outside the EU, but she will be under pressure from voters, many in her own party, and an aggressive tabloid press to achieve a significant fall in numbers. But that could leave the government with a shortfall in revenue (EU nationals contribute more in tax than they receive in benefits) and huge gaps in the job market. The NHS, for example, would be crippled without recruiting foreign doctors and nurses to fill skills shortages, some experts argue.

But it’s not just at the top end of the labour market that May will face pressure. Businesses in industries such as hospitality, tourism, construction, retail, and fruit picking say they’ll need to keep bringing in foreign workers to fill seasonal and low-paid jobs that Brits simply don’t want to do. But how does the government square that with voters’ expectations of reduced migration?

8. Save the City.

Britain’s banks and financial companies, which contribute about 7% of GDP, are worried that leaving the single market – and with it losing their “passports” to operate freely across other member states – will undermine London’s status as an international financial centre. Defending bankers is not a vote-winner, but striking a deal that preserves the City’s access to European markets will be one of the top economic priorities in the coming negotiations.

9. Maintain free transfer of data across borders.

In the modern economy, multinational companies send information about their customers between offices in different territories. And big technology players like Microsoft and Google are worried that if Britain no longer complies with the legal safeguards the EU has imposed to protect personal data, transfers between the UK and mainland Europe will be impeded. The tech industry wants the government to urgently seek an agreement so that the UK’s data protection regime will be considered up to scratch.

10. Disentangle the UK from the European Court of Justice.

Ending the jurisdiction of Europe’s most senior judges over Britain is one of May’s top Brexit priorities – an important part of “taking control of our own laws”, as the government’s white paper put it. But so broad is the court’s oversight that withdrawing from it will be tricky. It could be a stumbling block in agreeing a transitional deal.

11. Transfer 40 years of accumulated European law into the UK statute books.

The so-called great repeal bill, expected to be published by the government shortly, will in one swoop repeal the European Communities Act 1972 and transpose European law into UK law, ensuring legal continuity after Britain leaves. Much of it will have to be tweaked so that it still works. Then a longer process begins, of picking through that tangled web of laws to determine what the UK wants to keep. It will, the House of Commons library said, be one of the largest legislative exercises ever undertaken in this country.

12. Pass a mountain of other Brexit-related legislation.

The government will have to get between 10 and 15 bills through parliament in preparation for Brexit, on subjects such as trade and immigration, in a remarkably tight space of time. There won’t be room for much else on the legislative agenda in the next two years, the Institute for Government, a think tank, has said.

13. Keep the union together.

Scotland, which voted overwhelmingly to stay in the EU, is agitating for another independence vote. But there are also concerns that a hard Brexit could lead to a change of attitudes in Northern Ireland towards staying in the UK.

14. Divide up the repatriated powers.

Brexit will mean the UK takes full control over legislation, policy, and regulatory matters currently decided at EU level, but where, exactly, those powers reside will have to be determined. Leaders in Edinburgh, Belfast, Cardiff, and the English regions will not want it all to be held in Westminster, and will want to have more autonomy. The government will also have to work out how to replace funding that regions such as Wales have received from the EU.

15. Solve the border dilemma in Northern Ireland...

A hard Brexit raises a prospect that nobody wants: a return to a hard border between Northern Ireland and the Republic of Ireland. It’s not so much a political challenge as a technical one. All sides mostly agree on the principles, and nobody wants to hamper the peace settlement. But workable solutions to managing a land border between a country that is in the single market and enjoys free movement of people, and one that has withdrawn from it, have so far been elusive.

16. ...and don't forget Gibraltar.

Nearly 96% of the British overseas territory’s residents voted to remain in the EU, more than any other region by a long way. They’re concerned leaving the single market will cut off more than 10,000 workers who cross the border from Spain every day.

17. Protect workers from exploitative bosses.

Many of the legal protections available to British workers, on matters such as maternity leave, working hours, redundancy, discrimination, and equal pay, stemmed from Brussels. In its Brexit white paper, the government said it will prioritise workers. Unions, lawyers, and rights groups are worried that protections could be weakened as the UK tries to woo big businesses after Brexit.

18. Replace EU funding for scientific and medical research.

In recent years, British scientists have received billions of euros under EU initiatives such as Horizon 2020. The UK government has sought to assure them that it will prioritise science, research, and innovation after Brexit, including encouraging them to continue to bid for funding over the next two years. But scientific groups are extremely worried about financial support in the long run.

19. Secure a deal with the EU on security and defence cooperation.

Both sides have hinted that they want to deal with security and defence cooperation separately from other issues; Barnier has gone so far as to suggest it could be part of a separate framework. Defence cooperation between states largely happens either bilaterally or through multilateral arrangements such as NATO, so Brexit could have little impact. Still, some member states fear the UK will use its strength in intelligence, for example, as a bargaining chip to divide member states. On law enforcement, the UK wants to retain access to pooled resources including the Europol agency and the European Arrest Warrant, which make it easier to share information between police and intelligence services as well as extradite criminal suspects within the union. If agreements, or interim arrangements, can’t be reached, the UK could lose access to shared databases and face delays in investigating crimes.

20. Preserve Britain’s world-class universities.

Many in the higher education sector opposed leaving the EU and are anxious that a hard Brexit will impact them in several ways: by making it harder to get funding for research, restricting the number of EU students and academics who can come here to study and teach, and putting the UK’s participation in the Erasmus exchange programme in doubt.

21. Keep planes in the sky.

After leaving the EU, Britain is likely to drop out of Europe’s deregulated aviation market. New agreements will have to be urgently negotiated so that UK airlines can still land in their biggest market and operate flights within member states; a new deal covering UK airlines’ operations in the US will also have to be struck as a consequence of leaving the European market. There’s no fallback. If there’s no deal, or at least a transitional agreement, flights between the UK and Europe could be grounded in March 2019, Ryanair chief executive Michael O’Leary has warned.

22. Secure visa-free travel for tourists.

Britain’s tourism industry will be damaged if travellers from Europe who are accustomed to visiting the UK freely face visa restrictions or arduous border controls after we leave the EU, trade groups say. It will also be damaging to business if British holidaymakers face restrictions going the other way. The UK should, they argue, try to attract more tourists from countries outside the EU, such as India, by making it easier for them to obtain visas.

23. Preserve reciprocal healthcare rights for Britons abroad.

One of the little-known consumer protections available to UK citizens under EU membership is the ability to draw on healthcare while they’re travelling; around 215,000 Britons used the European Health Insurance Card in 2015. Testifying before a parliamentary committee this month, Brexit minister David Davis was asked this month if UK citizens would lose their privileges. “I think that is probably right,” Davis said. “I have not looked at that one.”

24. Establish a new agricultural policy.

Among those most profoundly affected by Brexit will be Britain’s farmers. More than half of UK farm income comes from subsidies under the EU’s Common Agricultural Policy, and most of the regulations governing the agricultural industries are determined in Brussels. Farmers complain they’re being left in the dark about the future of their funding. Some observers, however, argue that Brexit will be a chance to rejuvenate the industry. Agriculture is also likely to be a contentious issue in future UK trade deals, especially with the US.

25. Protect animals, consumers, and the natural environment.

In replacing the Common Agricultural Policy, the government will be pulled in all directions. On one hand, it will be under pressure from consumer, environmental, and rights groups to impose a new regime that demands even higher standards of agricultural businesses than the existing system. On the other, experts have warned that a free trade deal with the US will mean supermarket shelves are stocked with imported products that wouldn’t have made the grade, such as chicken washed in chlorine. Separately, groups such as the British Medical Association have warned that EU measures designed to protect public health, such as warnings on cigarette packs, must not be discarded after Brexit.

26. Set a new UK fisheries policy.

There's probably nobody who wanted Brexit more than Britain’s beleaguered fishermen, who believe that the EU’s Common Fisheries Policy mismanaged the country’s fish stocks and encouraged overfishing. They’re hoping the government will strike a new arrangement that will better suit UK vessels.

27. Keep up the fight on climate change.

Scientists and environmentalists are worried that an isolated Britain will have less sway in international debates about protecting the environment. It will, they say, have to find new alliances to push for global action – perhaps with other Commonwealth countries.

28. Safeguard Britain’s nuclear industry.

Since 1957, Europe’s nuclear power market has been governed by the European Atomic Energy Community (Euratom). Although the organisation is legally distinct from the European Union, the government said it will be withdrawing from Euratom as well as the EU. A new regime will have to be established to regulate the trading, transportation, and disposal of nuclear material. It will be extraordinarily complicated and costly and will almost certainly take more than two years, experts say. The stakes couldn’t be higher. “If we do not get this right, business stops,” Rupert Cowen, a lawyer, told a parliamentary select committee.

29. Establish a new regime for regulating the UK’s £32 billion chemical industry.

Leaving the single market is likely to mean Britain is no longer part of Europe’s system for the registration, evaluation, authorisation, and restriction of chemicals (REACH). Enforced by the European Chemicals Agency (ECHA), the system is designed to protect public safety and the environment but has become unpopular with many Eurosceptics who say it has imposed too much red tape on small businesses. However, some experts say establishing a separate UK regime for regulating chemicals will be costly and complicated and impose more bureaucracy on businesses, not less. And it’s highly unlikely it’ll be done in two years.

30. Establish a new regime for regulating drugs.

Britain’s pharmaceutical giants want to remain in Europe’s regulatory framework, allowing quick access to their second-biggest market (after the US). A separate UK regime would mean delays in the introduction of new medicines. The European Medicines Agency, based in London, is likely to be relocated to the continent – reducing Britain’s influence in the sector.

31. Ensure that English court judgments can still be upheld across Europe.

It’s not the sort of thing that gets attention from politicians or the press, but Brexit could mean judgments handed down by courts here are no longer automatically enforceable across EU member states. For some companies, that could make London a less attractive place to litigate – a big deal in a city with a multibillion-pound legal industry.

32. Maintain London’s status as a media hub.

Under “country of origin” rules, media companies in London such as Discovery and NBCUniversal are allowed to broadcast TV channels across the EU without obtaining separate licences. But a hard Brexit and retreat from the single market would force TV executives to look at relocating to another member state. Those media companies are also concerned about how EU copyright laws will develop when the UK loses its seat at the table.

33. Find money for the arts.

At present, a host of artistic and cultural projects across the UK are funded by the EU. The amounts of money involved are small compared with those in other sectors affected by Brexit, but senior industry figures say they’re not sure whether the Treasury will step in to plug the gaps at a time of cuts to public spending, and when it has so many other things to worry about.

34. Make a contingency plan for “no deal”.

One thing is certain: Britain will leave the EU in two years unless all member states agree to extend the negotiating window. Given the time pressure, it’s possible even with goodwill on both sides that negotiations will fail. The prime minister, egged on by Brexiteers, has insisted Britain is better off walking away with no deal than agreeing hastily to terms it finds unacceptable. And yet various experts agree it would be disastrous. Crashing out without even an interim arrangement would, they argue, lead to economic shock and legal confusion. As Barnier put it, there would be queues of trucks at Dover, serious disruption to air traffic, and overnight suspension of the movement of nuclear materials to the UK. The government will have to plan for the worst-case scenario. Each department should have a back-up plan, setting out proposals to mitigate the consequences of no agreement, the Commons foreign affairs committee said in February.

Other perspectives on this story

Outside Your Bubble is a BuzzFeed News effort to bring you a diversity of thought and opinion from around the internet. If you don’t see your viewpoint represented, contact the curator at bubble@buzzfeed.com. Click here for more on Outside Your Bubble.