The 2016 Summer Olympics boating and swimming events have put an international spotlight on what has been a long-running problem in Rio de Janeiro—untreated sewage and trash are clogging up major bays and waterways, including the Guanabara Bay, where many of the boating competitions are being held.

A 2015 Associated Press study found that the nearly black water contained alarming levels of bacteria and viruses and could potentially make athletes who were exposed to it sick.

“The majority of the sewage in Rio de Janeiro is not going through wastewater treatment plants the way we understand wastewater treatment plants [in the U.S.],” says Claudio Ternieden, a Brazilian citizen and director of government affairs for the Water Environment Federation.

This was not how the city government had envisioned the Rio Olympic events unfolding when it bid on the chance to host the summer games. Rio had promised the International Olympic Committee (IOC) that the city would build additional wastewater treatment plants in time for the 2016 events, which began in early August. The state government adopted a sanitation plan in April 2011 to improve both collection and treatment rates to 80% by 2018.

But a myriad of challenges in Brazil—including a spiraling financial crisis, unfolding corruption scandal, insufficient governance and enforcement system, and lack of ability or willingness to pay for connections to new sewer lines in some of Rio’s poorer neighborhoods, has made progress difficult, several sources say.

“It’s not just one aspect of basic infrastructure, says Ann Bui, managing director for water services in Black & Veatch’s management consulting business. “It’s the entire program—changing how the nation views its water and waterways,” she says, noting that the country is not only geographically large and diverse, but agencies, government officials, and citizens need to be educated about how to run and operate sanitation systems.

“There’s a lot of work that needs to be done there,” Bui says.

The main plant in Rio, the Alegria plant, completed in the 1990s, is running significantly under capacity, and only one new plant came online in June 2016. The Deodoro plant is built, owned and operated by a consortium of construction and sanitation firms called Foz Aguas 5.

The consortium, which includes Odebrecht, was awarded a concession in 2011 to spend about $640 million to build and operate 10 wastewater treatment plants as well as a network of sewer lines and associated infrastructure over the next 30 years.

The Deodoro plant, built near where many of the Olympic events are held, treats 64,800 cubic meters per day, 10 times the capacity of the Alegria plant and includes Royal Haskoning DHV’s Nereda technology, considered to be highly efficient.

“The new water treatment installation in Deodoro—the first in the Americas with Dutch Nereda technology—will contribute to better living conditions of many thousands of inhabitants in these poorer parts of Rio and will help to make the Guanabara Bay cleaner,” said Arjen Uijterlinde, Dutch consul-general in Rio, in a statement.

Although the new plant will help, the problem in Rio is overwhelming. The flow rate getting to the Alegria plant is about 30% of the design flow rate, says Kartik Chandran, a professor at Columbia University’s Dept. of Earth and Environmental and Earth Engineering.

“The connectivity is not there,” says Chandran. “There is simply not a very good pipe network to deliver the waste treatment into the centralized plant. Unless you get the sewage, fecal material and sludge, to the plant, there’s no point, and very often so many of these capital projects focus on the treatment and the final dimensions, without focusing on the other elements of the overall system.”

Chandran suggests a solution might be to build more decentralized plants. “There’s no way to connect all the [poorer neighborhoods] to these centralized plants,” he says.

The Olympics faced more bad publicity when the water in the pools for swimming events turned green. The International Olympic Committee claimed that the green water was due to a "sudden change in water alkalinity" and added that a sudden change in the weather, with strong winds and rain after days of sun in the swimming pools, caused unexpected proliferation of algae.

The IOC has noted that there was no risk to athletes from the green water, but many athletes complained, and the pools were drained and refilled.

Augusto Diniz is the editor of O Empreiteiro magazine, a construction publication in Brazil.