And here you thought your window for traveling to Cuba had been unceremoniously slammed shut.

When the Trump administration announced earlier this month it was severely curtailing US travel to Cuba, your dreams of smoking cigars in bright pink ‘57 Chevys seemed shot. The old “people-to-people” visa was cancelled, cruise ships halted port calls, and day trips from Key West hotels went back to being the stuff of 1940s fantasies.

But all is not lost. A number of tour operators bent on getting folks to Cuba have found ways around the Trump administration’s ban. By carefully examining the remaining categories of travel, and taking advantage of a few exceptions to the law, these companies offer tours that allow you to get right into the heart of the island. Best of all, you’re doing it completely legally.

So how are they doing it? And how is any of this legal? We talked to some operators taking Americans to Cuba, and they broke it down.

Pre-existing tours are grandfathered in.

When the ban was announced, the administration allowed anyone who’d purchased one leg of travel before June 5 to continue with their plans. That means if you’d booked a flight, hotel, tour, rental car, or other travel products, your old people-to-people visa was still good to go.

Theoretically, you’d think this means if you hadn’t booked something already you’re SOL, but that’s not the case.

Because tour companies are the ones doing the actual purchasing of travel products — hotels, buses, etc. — they are still eligible for the people-to-people visas. And if you buy into one of their tours for which they’ve already made plans, Cuba is all yours.

“Because (we) had already reserved hotel accommodations for people-to-people trips in Cuba prior to June 5, anyone traveling with us to Cuba on a people-to-people program is grandfathered in as completely legal,” explained Edward Piegza, president and founder of Classic Journeys, which will be running Cuba trips through the end of the year.

The same goes from smarTours, which will be running trips through 2020 including the Best of Cuba tour, which stops in Havana, Cienfuegos, Camagüey, and Holguin. And the Cuba Up Close tour which includes stays in private homes and exchanges with local artists and musicians. The latter, smarTours hopes, will still qualify for visas even after its existing tours are over.

“In the future, past 2020, we’ll be looking into options under the ‘support for the Cuban people’ category,” said Kendra Guild, smarTours’ director of product and operations. “We have a tour where people stay in private homes, which qualifies.”

So you may not be able to live like Hemingway at the Hotel Nacional, but you can still visit the island. Your airline will still ask for your visa type when you book, so you’ll need to select “people-to-people with the grandfather clause.” If the airline doesn’t offer that, Piegza suggested selecting “educational activities,” so long as there’s no mention of a degree. If the airline doesn’t offer that, he said it’s probably still playing catch-up, and to check with other airlines.

Support for Cuban people is the new ticket in.

These grandfathered trips are all well and good if you were planning to go to Cuba in the next couple of years. But what about beyond that?

A couple of tour companies have looked carefully — with lawyers! — at the dozen remaining categories under which Americans can legally travel to Cuba. Under the “support for Cuban people” visa, they’ve found ways to operate tours, with one slight change.

“The people to people required us to provide a chaperone who ensured we were fulfilling the requirements of that visa,” said Michael Edwards, managing director for Europe and the Americas at Intrepid Travel, which will be continuing its Cuban tours as Hola Cuba for US citizens. “Under the new amendment, it’s the responsibility of the traveler to document their interactions. We’ll no longer have a chaperone, but we’re providing all travelers with a diary, and we’ll give time to document interaction with Cuban people and culture.”

Sounds like a pretty simple loophole, but Edwards insisted his team looked at the law carefully and found this to be completely on the books.

“For us, to continue running this trip was paramount,” he said. “To not be able to run it is pretty depressing in 2019, not to get people to experience the country. So we’re happy we found a way around it that complies with the amendment.”

Friendly Planet will also continue Cuba tours under the “support for Cuban people” visa. Founder Peggy Goldman said her trips more or less fell under this stipulation already, and she’s excited to continue introducing people to Cuban culture.

“We have used and will continue to use paladars for meals. We have stayed and will continue to stay at casas particulares,” she said. “We have visited and will continue to visit and support community projects that benefit artists, musicians, educators, farmers and most especially, the entrepreneurs. Our departures will be smaller than before, but we will continue to be 100 percent compliant with the law.”

She did warn, however, that travelers need to stay with their group and participate in the group activities, since wandering off on your own might inadvertently put you out of bounds of US regulations. She also suggested keeping your records for up to five years.

As far as visas go, travelers will still be responsible for obtaining them. But Intrepid, at least, will refund your tour price if your visa is denied.

“We understand the sensitivities around it,” Edwards said.

So, though going to Cuba isn’t as simple as stepping off a cruise ship, you can still make it happen. Despite the government’s efforts to keep US citizens from visiting, enterprising travel companies have found a way to make it happen — hopefully keeping our cultural exchanges going no matter the political situation.

“You can never say what planned legislation will come along,” said Edwards, “and it’s reasonable that other changes may happen. But hopefully we’ll still find ways to run tours to Cuba for U.S. citizens. We’re pretty confident at this stage.”