After six years of operating in San Francisco, Airbnb will finally become legal on its own home turf.

The city’s board of supervisors voted to legalize and regulate short-term stays through a controversial piece of legislation that has been two years in the making and comes in the midst of one of the city’s most acute housing shortages in history. David Chiu, who is the president of the board of supervisors and is running to represent San Francisco in the state assembly this November, has been the one leading the legislative process.

I wrote a piece earlier today describing some the law’s changes and some of its more controversial points. The key changes include a limit on non-hosted rentals for up to 90 days per year. That’s on the concern that Airbnb will eat into the city’s limited housing stock.

Another key point is the creation of a public registry, where hosts will have to pay a $50 fee, register with the city Planning Department and pledge that they’ll abide by the 90-day limit. They’ll also have to pay the city’s hotel taxes. They — not Airbnb — are responsible for certifying that they’re only hosting 90 days a year and for keeping records that prove this.

During the four-hour long debate, city supervisors added several more amendments. Those include:

-A private right of action in specific cases. Before, the law was primarily reactive. The city planning department, which is already overloaded and doesn’t have the financial or headcount resources to police thousands of short-term rentals, would respond to complaints.

Now, if a building has a history of Ellis Act evictions, there is a private right of action for housing non-profits to sue and stop that activity. They are not eligible for civil penalties, so they aren’t financially motivated. They also have to have been around for at least five years, which will prevent people from inventing non-profits to file frivolous lawsuits.

There’s also a private right of action for these non-profits to sue in clear cases when there are residential housing units that appear to have been converted into permanent hotels.

-Buildings that have had Ellis Act evictions are also not eligible for short-term stays. What’s the Ellis Act? Well, San Francisco city and California state rental laws have some strange overlaps. The city has incredibly strong rent control laws, that cover 172,000 of the city’s 376,000 housing units. As long as the tenant handles their basic obligations like paying rent on time, they can’t really be evicted and there’s a culture of lifetime tenancy in the city that’s fairly unique. But the state of California passed a law in the mid-1980s that allows landlords to “go out of business” and take their rental units off the market. The concern in red-hot San Francisco housing market is that this law is abused and landlords will take their units off the market to convert them into tenancies-in-common or permanent Airbnb rentals. This change is supposed to clamp down on that.

There were also a couple of rejected amendments.

-David Campos, who is Chiu’s rival in the election next month, wanted Airbnb and other hosting platforms to pay an estimated $25 million in back taxes.

He said, “I’m proud that Airbnb started here in SF on air mattresses and now it is a company valued at $10 billion.” But he added, “This is about ensuring that a multi-billion dollar company has to pay their fair share of taxes. It shouldn’t be the little people who should pay taxes. It should be everyone who benefits from being a part of this city that has to pay their fair share.”

The issue with the amendment, however, is that it would prevent the law from taking effect until the city treasurer certified that back taxes were paid. Then there would be this whole question of collection. Would it come from the company? Or would the company be compelled to go after every single one of its hosts over the past six years to pay for previous taxes?

-Another amendment to cap hosted rentals up to 90 days. This was out of concern that enforcing hosted versus non-hosted rentals would basically be impossible. How would you tell if hosts were present or not? Again, this was struck down based on a lot of feedback from home sharers that they are very dependent on their income to pay for living costs.

“There are many people who absolutely rely on the income that they derive from these hosted rentals to make it in San Francisco,” said supervisor Scott Wiener, who represents part of the Mission and the Castro District.