Rio de Janeiro has in recent years evicted drug dealers from hillside slums, carved fast-moving bus lanes into sclerotic streets, and cracked down on unauthorised food vendors along the city's 93 km of beaches.
Now, as they gear up for the 2013 Carnival, officials are taking aim at another old Rio scourge: public urinating.
Urine flows as freely during Rio's famous annual festivities as beer and the cane liquor known as cachaça.
For as long as locals remember, the sight of people relieving themselves - and the stench of their steamy puddles - has been as much a part of Carnival as half-naked women, samba schools, drag queens, body paint, and drunk and sun-burned foreigners.
But Rio, Brazil's second-largest city and its most popular tourist destination, now wants to stop the peeing.
To sanitise some of the revelry, officially starting on Friday, city hall has deployed thousands of agents to spot and detain offenders. It's a dry run, if you will, before Rio hosts World Cup soccer matches next year and the 2016 Olympics - events that are also expected to inspire celebration.
"It's the biggest complaint we get," says Alex Costa, Rio's secretary for public order, echoing angry residents whose doors, curbs and car tires get anointed by bursting bladders.
In recent weeks, the city has touted the number of "mijões," or "pee-ers," that agents have detained during pre-Carnival rehearsals and block parties: 321 since Jan. 20, including 16 women and three foreigners. Particularly lewd offenders are fined, but most detainees merely get shuttled to police stations where they miss the rest of the party.
"We just want to educate," Costa says, "give people pause."
The pee patrol is part of an overall effort to impose more order as Carnival's popularity soars.
Like Mardi Gras and other similar celebrations, Rio's Carnival stems from the tradition by some Catholics to get sins out of their system before the austere season of Lent.
Not too long ago, a volatile economy and rampant crime relegated most of the celebration to a sterile, concrete promenade where professional parade organisers compete in a televised spectacle. It's a far cry from grass-roots revelry.
As Brazil's economy rebounded in recent years, city officials cleaned up Rio's marquee neighbourhoods. Block parties and amateur street parades blossomed; adding to events expected this year to generate $US665 million for the local economy.
In the past four years, the size of marches by neighbourhoods groups, trade organisation, and other cliques has doubled, attracting a projected 6 million people this Carnival. Nearly 500 "blocos," as the bibulous bunches are known, are scheduled to march by Carnival's end next Wednesday.
To cope, the city has deployed 18,000 portable toilets around town. Along with thousands of police already on patrol, 7700 municipal agents, more than twice as many as last year, control everything from unlicensed street vendors to illegal parking.
They're also pursuing pee-ers.
Last Sunday, 25 of the agents worked Suvaco de Cristo, or Christ's Armpit, a popular "bloco" that parties beneath the right arm of Rio's iconic Christ the Redeemer statue.
In plain clothes so as not to draw suspicion, the agents stood out anyway among 25,000 partiers donning everything from lingerie and Angry Birds masks to grass skirts and devil suits.
The agents milled about side streets and a nearby canal, where their targets might drop trousers. They looked behind trees and between cars, where female offenders often squat.
At first, the pickings were slim. "They haven't drunk enough yet," said Marcelo Maywald, who leads the patrols.
But soon enough, two men in miniskirts, blonde wigs, and sailor caps stumbled toward the wall of a hippodrome. Four agents surrounded the men just as they started to urinate.
Though perturbed, the "mijões" finished the task at hand. When they turned, the agents accosted them. "Come with us," one agent said. "You know you shouldn't do that."
Nearby, Mr Maywald nabbed a shirtless man in a straw hat.
The agents walked the three offenders to a curb while they radioed for a nearby van. "Don't worry," Mr Maywald stressed, "this isn't about punishment. We just want to build some awareness."
The agents, in fact, aren't armed; they don't even carry handcuffs. Sensing as much, the man in the straw hat ran off.
"He's quicker than us," one of the wigged men said, "or maybe he's just more sober."
Mr Maywald wasn't amused. "That was one of mine," he griped.
He and two agents then hopped into a pickup truck and sped to pass the procession. The "bloco" crept behind a sound truck past the colonnade of palm trees lining Rio's botanical garden.
In a square, the revellers rallied like runners at the end of drunken marathon. Catching "mijões" was like shooting fish in a barrel.
One woman clapped as the agents caught them. "You are disgusting!" she yelled at the offenders. "You are pigs!"
Meanwhile, Felipe Rodrigues, a 21-year-old soldier in plaid shorts, unzipped by the side of a bush. Mr Maywald snuck to the other side and pretended to field a phone call. When Mr Rodrigues was done, Mr Maywald walked over and collared him.
Five minutes later, Mr Rodrigues sat in an open van while two friends taunted him. "Can you give us a ride?" they asked.
Mr Rodrigues, still buzzed from his morning beer, shrugged. "Of course, I was in the wrong," he said, "but I really had to go."