Facebook is making significant changes to its advertising platform after the social media monolith was accused of enabling discrimination in housing, employment, and lending.

The changes come after years of scrutiny into Facebook’s ad practices, which appeared to allow advertisers to purposefully exclude certain people from seeing housing, employment, or lending ads.

Last year, the Department of Housing and Urban Development filed a complaint against Facebook, claiming that the social media giant’s advertising platform enabled property owners to discriminate against prospective renters and buyers based on their race, color, religion, sex, familial status, national origin, disability, or other factors.

HUD’s investigation began in response to a ProPublica article in October 2016, which said Facebook gave advertisers the ability to exclude certain ethnic groups from seeing the ads.

Fair housing groups later filed a lawsuit against Facebook in March 2018, saying its ads still discriminate against protected groups under the Fair Housing Act, including women, veterans with disabilities and single mothers.

After HUD filed its complaint against Facebook, the site announced that it was removing more than 5,000 ad target options to “help prevent misuse.” The site claimed that the removed options include “limiting the ability for advertisers to exclude audiences that relate to attributes such as ethnicity or religion.”

But Facebook announced Tuesday that it is undertaking a massive overhaul of its advertising platform that goes well beyond any of the previously announced changes.

According to Facebook, it will no longer allow anyone or any company to target housing, employment, or credit ads by age, gender or zip code.

Additionally, advertisers offering housing, employment and credit opportunities will have a “much smaller set of targeting categories to use in their campaigns overall,” Facebook said.

The site also said that any detailed targeting option “describing or appearing to relate to protected classes” will also be unavailable for advertisers.

Beyond that, the site said that it is building a tool that will allow users to search for and view all current housing ads in the U.S., regardless of where the ads are targeted.

“One of our top priorities is protecting people from discrimination on Facebook,” Facebook Chief Operating Officer Sheryl Sandberg said in the announcement.

“We’re proud that our services help businesses reach people all over the world who are interested in their products and services. Small businesses now have access to marketing tools that previously only big companies could afford. This levels the playing field so that they can reach audiences they care about,” Sandberg continued.

“Our job is to make sure these benefits continue while also making sure that our ads tools aren’t misused. There is a long history of discrimination in the areas of housing, employment and credit, and this harmful behavior should not happen through Facebook ads,” Sandberg added.

“Housing, employment and credit ads are crucial to helping people buy new homes, start great careers, and gain access to credit,” Sandberg said. “They should never be used to exclude or harm people. Getting this right is deeply important to me and all of us at Facebook because inclusivity is a core value for our company.”

The announcement is the result of a settlement with the fair housing groups that sued the site, which include the National Fair Housing Alliance and the American Civil Liberties Union.

In a post on its site, the ACLU goes into more detail about how Facebook’s newly announced ad changes will be implemented, including the creation of a new and separate advertising portal for housing, employment, and credit ads.

From the ACLU:

In the first-of-its kind settlement announced today, Facebook has agreed to create a separate place on its platform for advertisers to create ads for jobs, housing, and credit. Within the separate space, Facebook will eliminate age- and gender-based targeting, as well as options for targeting that are associated with protected characteristics or groups. Targeting based on zip code or a geographic area that is less than a 15-mile radius will not be allowed. And Facebook will stop considering users’ age, gender, zip code, or membership in Facebook “groups” when creating “Lookalike” Audiences for advertisers. Facebook will also require advertisers for employment, housing, and credit to certify compliance with anti-discrimination laws, and it will institute a system of automated and human review to ensure that such ads are properly identified and channeled into the separate flow. Additionally, due to a three-year monitoring period in the agreement, we’ll be watching Facebook’s progress closely to ensure that it implements these changes fully.

“Today’s changes mark an important step in our broader effort to prevent discrimination and promote fairness and inclusion on Facebook,” Sandberg said. “But our work is far from over. We’re committed to doing more, and we look forward to engaging in serious consultation and work with key civil rights groups, experts and policymakers to help us find the right path forward.”

In its statement, the NFHA said that it will work with Facebook to develop an in-house fair housing training program for Facebook leadership and staff. Additionally, the fair housing groups will monitor Facebook’s advertising platform on a continuing basis to ensure that future advertisers do not engage in discrimination.

“This settlement positively impacts all of Facebook’s 210 million users in the U.S. since everyone is protected by our nation’s fair housing laws,” said Lisa Rice, president and CEO of NFHA. “As the largest digitally-based advertising platform and a leader in tech, Facebook has an obligation to ensure that the data it collects on millions of people is not used against those same users in a harmful manner.”