Facebook is no stranger to controversy, and the social network found itself in the spotlight again last month when a report found that brands could use a Facebook ad-targeting feature called “ethnic affinities” to exclude users of a specific race from seeing certain ads.

While Facebook has argued that the tool is designed to give brands a way to “reach multicultural audiences with more relevant advertising,” that isn’t necessarily how the tool will be used. For example, a company seeking to rent / sell houses, or find employees, could in theory elect to exclude African-American or Hispanic users from seeing the ad. This revelation was controversial for a number of reasons, but chiefly because federal law prohibits ads for housing and employment that exclude people based on gender and race.

In response to the outcry, Facebook has announced it’s making some changes to how the tool works. Indeed, the company says that it is building tools that will automatically detect and disable ethnicity marketing for certain ads, specifically those involving housing, credit, or employment. “There are many non-discriminatory uses of our ethnic affinity solution in these areas, but we have decided that we can best guard against discrimination by suspending these types of ads,” explained Erin Egan, VP of U.S. public policy and chief privacy officer. “We will continue to explore ways that our ethnic affinity solution can be used to promote inclusion of underrepresented communities, and we will continue to work with stakeholders toward that goal.

Additionally, Facebook says that it will “offer more clarification and education” by updating its advertising policies to require that advertisers confirm they won’t discriminate in their advertising on Facebook.

“We are constantly trying to find ways to improve enforcement of our anti-discrimination policies,” added Egan.