LIVINGSTON, Mont. — For 25 years, Bill Phillips toiled as a machinist in the rail yard here — a fancy title, he jokes, for someone whose job was to play in the muck. Now 77 and suffering from asbestosis, a scarring of the lungs caused by inhaling asbestos fibers, Phillips still looks like he just strolled off the yard, dressed in worn overalls over a red T-shirt and sporting a Smokey the Bear baseball cap and a thick white mustache.

Phillips is lively and funny. He can tell stories with the best of Livingston’s old-timers, and he doesn’t mince words about his former employer’s legacy in this picturesque gateway to Yellowstone National Park.

“Rip, rape and run,” he said.

Livingston had always been a rail town. The Northern Pacific Railway founded it in the early 1880s as a strategic midway point between its hubs in Minneapolis and Seattle. It was a place to service steam engines before sending them west over the treacherous Bozeman Pass. A spur line, now abandoned, headed south to America’s first national park, making Livingston and the surrounding area one of Montana’s first tourist destinations.

Thomas Lee for HuffPost Bill Phillips, 77, on his front porch along the Yellowstone River east of Livingston. Phillips was a machinist for the railroad.

The railroad built this postcard-pretty town, fueled its once-vibrant economy, and employed more than 1,000 workers in its heyday. It also polluted its soil and groundwater. And then it left.

For nearly a century, men disassembled and repaired locomotives in the town’s massive red-brick repair shops, some of which still stand today. They chipped asbestos from the boilers, used nasty chemical degreasers and watched the mess swirl through French drains directly into the groundwater. Nobody gave much thought to the environmental hazards. It was steady work that paid well, until it didn’t.

Northern Pacific was reorganized into Burlington Northern Railroad in 1970, and by the early 1980s its local workforce had shrunk substantially. The company finally shuttered the Livingston shops in 1986, laying off or transferring the last workers. Hundreds of union jobs evaporated. Houses sat on the market. Businesses folded. The population dropped 4.2 percent between 1980 and 1990.

The town fell into a depression for a time. But three decades later, most storefronts are once again occupied as Livingston has transformed into a hub for arts and tourism. Visitors arrive in droves each summer, many en route to Yellowstone, 56 miles south. The historic 1902 Northern Pacific train station, designed by the same architects behind New York City’s Grand Central Terminal, is now a museum and community center known as the Livingston Depot Center. There are two live theaters, 14 art galleries, a slew of bustling nonprofits, quality restaurants and microbreweries, where anglers trade stories about the day’s catch.

Acclaimed writers like Tom McGuane, Tim Cahill and Maryanne Vollers live in or near this town that now numbers about 7,500 people. Celebrities like Michael Keaton and Tom Brokaw own land nearby. Robert Redford filmed a couple of movies here, most notably “A River Runs Through It,” a film that invigorated the fly fishing industry and goosed real estate prices so sharply that the Montana Department of Commerce coined a new term for it: “A River Runs Through It Syndrome.”

But the remnants of the railroad industry still lie beneath the idyllic surface ― a toxic sludge that has tainted the groundwater for decades. Livingston’s industrial past left behind a two-mile long plume of diesel fuel and chlorinated solvents, along with lead, asbestos and a slew of other pollutants.

Thomas Lee for HuffPost A deer grazes near the Livingston rail yard, one of 18 state-recognized superfund sites tied to Burlington Northern Railroad's operations.

Old railroad workers have no shortage of material about their days working the yard. One that surfaces regularly involves “Track 11,” the rail furthest from the maintenance shop. When oil inside a diesel locomotive became contaminated with water or sand, workers would typically pump it out and salvage the lubricant. But on a tight schedule, they’d put the train out on track 11, Phillips said. “They’d grab you and say, ‘Go down to the east end down there and knock the plug out of that son-of-a-bitch and open the valve on it and you ride it back and forth until it is empty. OK?’”

Phillips said he once refused instructions, and when he returned to work the next morning, someone else had done the job. He recalls finding some 200 gallons of fresh oil on the ground. That was in 1972, not long after the Environmental Protection Agency was first created. By that point, they’d been dumping oil and chemicals for decades, Phillips said.

Livingston isn’t the only railroad town in Big Sky country where Burlington Northern left a mess. There are 18 state-recognized superfund sites tied to the company’s operations.

Doug Thomson, 71, spent 34 years with the railroad, about a third of them working in the paint shop, where he said men often passed out from the noxious fumes. When workers finished stripping down a locomotive, there’d be a mess of chemicals and paint on the ground.

“Shit all over the place,” Thomson said. Workers would take a big pressure hose and spray it out the door; superintendents often said things like “it’ll soak in,” or “it’ll evaporate,” he said. The railroad’s attitude was “cavalier,” Thomson said ― what it did in Livingston was its business, because it was there first.

“There is a little bit of shared guilt, because I knew better,” Thomson said on an August afternoon at his home, just a stone’s throw from the rail yard. “But they didn’t really give you any alternatives. … What are you supposed to do with it? Take it home with you?”

Thomas Lee for HuffPost Doug Thomson lives just a short walk from his former job at the railroad yards in Livingston.

Dick Murphy, who started working for the railroad right out of high school, said he witnessed many large diesel spills at the rail yard’s fueling station, where the company would often fill several locomotives at once. When automatic shut-off valves didn’t work — Murphy said this happened often — and workers weren’t paying attention, fuel would overflow. Diesel would cascade down the length of the yard back into the roundhouse before anyone noticed.

Murphy, Phillips and Thomson were among a select few to first speak out about negligence at the yard back in the 1970s, earning themselves reputations as troublemakers. Though America was beginning to wake up to the threats of industrial pollution at that time, the railroad remained a powerful force.

HuffPost is hitting the road this fall to interview people about their hopes, dreams, fears ― and what it means to be American today.

It wasn’t until 1977 that the Montana Department of Environmental Quality started cracking down on violations at the rail yard. The state filed a lawsuit seeking $340,000 in civil penalties, eventually reaching an agreement for the railroad to pay a smaller penalty and change its practices.

In the mid-1980s, county employees discovered that the company had for years been hauling barrels of toxic waste to the county landfill. The discovery triggered an investigation that ultimately turned up a plume of diesel that had soaked through the soil and was floating on the groundwater. Estimates for the amount of fuel beneath the surface varied widely, from 150,000 to 1.6 million gallons. A second plume of volatile organic chemicals, some considered likely carcinogens, extended nearly two miles east from the Livingston complex, clear under the Yellowstone River.

In 1988, two municipal wells on the northeast end of town were shut down after testing positive for contaminants, and the railroad was forced to pay nearly $2 million to dig new ones outside the impacted area.

More lawsuits followed. Park County, of which Livingston is the seat, in 1997 sued the railroad ― which by then had merged with another company to become Burlington Northern Santa Fe ― over the dumping at the landfill. In 1999, a jury awarded the county $14.7 million.

C&P Packing, a nearby slaughterhouse, claimed the railroad’s pollution had left its own land unusable. BNSF ultimately bought the property and the slaughterhouse closed down, idling its workers. The company also bought and razed a riverside motel and campground across from an unlined pit where sludge was stored. A number of Montana rail workers received settlements over claims that they suffered brain damage from exposure to harmful degreasers.

“I keep waiting for the shoe to drop,” Thomson said of his own health.

All of the men he worked with in the paint shop are now dead, he said. “When you worked in the coal mine, you knew what you were walking into. When you were working in that place, you didn’t know what [chemicals were] following you around,” he said.

Thomas Lee for HuffPost Dick Murphy lives with his dog, Annie, in a cabin along Mission Creek, east of Livingston.

As the legal battles waged on in court, the state environmental quality department was working with BNSF to investigate the scope of the contamination and come up with a remediation plan.

In 1994, the federal Environmental Protection Agency proposed listing the complex on its Superfund list, the program responsible for cleaning up the nation’s most contaminated sites. But it stayed off the list because no Montana governor had requested it be added.

In 2001, the Montana DEQ published a detailed cleanup plan that it said “protects public health, safety, and welfare, and the environment.” But in 2006, unsatisfied with the slow pace at which the railroad was moving forward on the plan, the department sent a letter to then-Gov. Brian Schweitzer (D) encouraging him to step in and end negotiations with BNSF. Schweitzer did.

“What we’ve gotten for decades is delaying, delaying, delaying,” Schweitzer told a meeting of Montana’s Rail Service Competition Council in March 2006, as the Billings Gazette reported. “Instead of lawyering, let’s go get that diesel out of the ground. Let’s clean up that aquifer, and we’ll send them the bill.”

Today, decades after Livingston learned about the mess its beloved railroad left behind, the cleanup continues. Katie Morris, the project manager for DEQ, said the majority of the contamination has been addressed. A 6-acre cinder pile, where the railroad had discarded burned waste for years, has been capped, locking in place large amounts of asbestos.

In May, DEQ granted BNSF permission to begin disassembling its petroleum recovery system, a series of 40 wells and a water treatment facility that came online in 2007 and ran for seven years. Some 50,000 gallons of diesel have been removed from the groundwater, and bioventing wells will remain in place to allow for natural breakdown of the remaining fuel, according to the state.

Thomas Lee for HuffPost Livingston boasts a historic and thriving downtown. It caters to tourists with landmarks like the restored 1902 Northern Pacific Railroad depot, as well as bars, restaurants and art galleries.

David Erickson, the firm’s manager and principal hydrogeologist, said a lot of progress has occurred at the site over the last three years, as his team has started putting the settlement money to work. To tackle the plume, which Erickson said is likely the largest solvent spill in Montana, the company is using a series of injection wells to pump air down to the top of the bedrock and force the PCE in the groundwater to the surface. There, a sort of vacuum sucks up the vapors. For the high levels of PCE trapped in the bedrock, the team has turned to anaerobic bacteria that feed off the solvents.

“It’s like a symbiotic community of bugs down there,” senior hydrogeologist Pat Thomson said.

Erickson, who served as an expert witness for the plaintiffs, credits the lawsuit for work finally getting done in Livingston.

“We had a goal to clean it up for the citizens,” but BNSF “was in the bean-counter world where their goal was to manage this liability,” he said. “With that citizen lawsuit and a fund to clean it up, we’ve done more to remediate solvents in the last three years than [the railroad] has done in the last 20.”

Erickson estimates active remediation will continue for another five to eight years, followed by another 20 years of active monitoring. He already considers Livingston a success story; no longer are chlorinated solvents leaving the site.

In August, the EPA withdrew the Livingston railroad complex from consideration for Superfund designation, citing BNSF’s commitment to complete the remediation actions set forth by the state. DEQ supported the move.

BNSF spokesman Ross Lane said the company “has made a substantial financial commitment to remediating” the site and plans to continue working with the state. “Standards of care have substantively evolved in the 100-plus years of railroad operations and we are dedicated to being good stewards of the environment,” he wrote in an email.

Thomas Lee for HuffPost The Yellowstone River is perhaps the only conduit passing through Livingston with more historic importance than the railroad. Not only a major international fishing destination, the river gives Livingston a source of hope, recreation and livelihood.

Some, however, wonder if Livingston will ever be completely rid of the mess, and have a hard time trusting DEQ or the railroad.

Bob Raney was a train conductor for about 25 years and served in the Montana House of Representatives from 1985-2000. He and his wife, Jeanne-Marie Souvigney, were also actively involved in cleanup efforts at the railroad site. The community had to fight “every step of the way,” Raney said. And while fear brought the community together, he added, fatigue long ago set in. Most of those who spent years in this drawn-out fight have moved on to other things.

One group still tracking the cleanup is the nonprofit Park County Environmental Council. Executive Director Michelle Uberuaga said while the group has confidence in DEQ’s cleanup plan, it opposes EPA’s decision to no longer consider the site for the federal Superfund program.

“As a community, we want all the tools to get to the finish line,” she said. “And we’re not there yet.”

Livingston isn’t the only Montana town living with a legacy of industrial pollution, as Melissa Nootz, a wife and mother of two daughters, knows all too well. She and her family moved to Livingston from Anaconda, about 130 miles to the west, in 2015. Anaconda is home to a large Superfund site, with more than 300 square miles of soil and water left contaminated with heavy metals by a former copper smelter.

A number of factors influenced Nootz’s decision to move. Her young daughter testing positive for elevated levels of lead a year earlier at the age of 1, she said, was “certainly not a reason to stay.”

Nootz, 41, and her husband learned about Livingston’s contamination when they started looking to buy a home, and residents warned her to steer clear of the town’s east side. “I’m like, OK, this again?” she said. “We’re dealing with this again?”

Nootz, Uberuaga and several others interviewed for this story voiced concern about the Trump administration’s push to gut funding for the Environmental Protection Agency and roll back its regulations, worrying about the impact these moves could have on communities like Livingston.

Today, a new and much smaller company, Montana Rail Link, runs trains through town and operates the roundhouse and mechanical shop — careful not to replicate the costly environmental legacy of its predecessor. Complaints about the company are largely limited to traffic jams at the city’s three congested railroad crossings and noise. (The Murray Hotel provides its guests earplugs, with a label that reads, “if by chance you don’t find train whistles romantic during the night.”)

Thomas Lee for HuffPost Businesses line West Park Street, across the street from the old train station.

While the town hasn’t yet seen prosperity comparable to its railroad heyday, there are bright spots. After languishing for a time, the real estate market has bounced back. The outdoor recreation industry is humming. A high-tech printing company, Printingforless.com, started here in 1996 and now employs approximately 250 people and brings in $31 million each year from clients around the world. The sawmill on the edge of town is still in operation, and a new riverside hospital — one that looks like a ski lodge and overflows with top quality local art — provides good jobs. It was built largely with millions of dollars of donated money, much of it from people who own seasonal homes here.

Creative types are drawn here. But they’re finding the days of cheap housing are long gone. And that means lots of local employers have a hard time finding help.

“Economically, it’s challenging,” said Katherine Taylor, a songwriter who has lived here for a little over a year. “To be happy here, you’ve got to be passionate about what you’re doing, whether it’s your job or your creativity.”

Most people don’t give much thought to the rail yard these days. Indeed, many of Livingston’s younger residents seem unaware there was — and still is — a problem. An earlier generation of whistleblowers, community activists and lawyers made it possible for Livingston to soldier on ― for people to work and play, fish and party, without worrying about contaminants in their tap water or in the river.

In Partnership with