If you’re a fan of pyrotechnics shows, just thinking about fireworks probably conjures up a fond memory of oohing and aahing along with a crowd, as colors burst overhead and smoke drifts across the — hey, wait a minute.

Sorry, but I’m here to rain on your fireworks, because those delightful explosions come with a hefty dose of pollution. It doesn’t have to be that way, though — in fact, many municipalities are seeking out alternatives that allow residents to enjoy the fun, minus the environmental impact.

Here’s the problem: Fireworks are made by combining gunpowder with metal that will react as it heats and ignites — that’s what causes the different colors and nifty visual effects. They also historically came packed with sodium perchlorate to act as an oxidizer to fuel that reaction. The explosion itself generates smoke as a byproduct of combustion, and along with it, tiny metallic particles that aren’t great for people — or animals — to breathe.

Researchers in Spain found that after major festivals, concentrations of strontium, copper, antimony, sulphur dioxide and lead, among many others, were much higher in urban areas than they should be. The pollution came not just from municipal fireworks displays, but also from members of the public who set them off in their backyards, just as millions of Americans do around the Fourth of July. They noted that poor quality control and questionable sources made some fireworks more hazardous than others.

Researchers have also found perchlorate in lakes after major fireworks displays. Surprisingly, the United States doesn’t actually regulate perchlorate content in fireworks, so companies have no particular reason to seek an alternative — unless consumers pressure them. Another source of pressure may be regional environmental agencies, which have the power to require permits from entities putting on major fireworks shows.

Between packaging, casing and other components, fireworks also generate a lot of litter. In the case of municipal displays, cities may have a contract clause requiring operators to clean up, but citizens feel no such obligations. The aftermath of a fireworks-laced weekend can include plastic and cardboard debris far and wide, from explosions as well as abandoned packaging.

The good news is that if you love the environment andexplosions — like me — you actually can have your cake and eat it too. Researchers are developing less toxic oxidizers, as well as safer compounds that create dramatic color effects — and they’re even thinking about more eco-friendly shell casings. One of the biggest challenges the planet-loving crew faces comes in the form of the ubiquitous red firework, which is actually quite hard to create with eco-friendly compounds.

Disney uses compressed air to launch its fireworks, with the goal of achieving smokeless displays. That’s more enjoyable for theme park guests, but it also benefits the surrounding environment. It’s an important consideration for a business that puts on numerous shows annually.

One of the best sources for research into this issue may surprise you, because it’s the military.

Military personnel use flares that are very similar to fireworks in design, and as part of a goal to be a greener citizen, military researchers have been exploring cleaner burning materials and better packaging to reduce their environmental impact. One reason why? The military is still paying a high price for cleaning up pollution at abandoned bases across the United States, and it’s not eager to perpetuate the problem. In the short term, their work benefits civilian fireworks fans.

As you get ready to celebrate Independence Day, ask local officials about the fireworks used, and the specifics of the city’s contract with the company that puts on the show. If they aren’t using environmentally friendly options, ask why — and be sure to wear respiratory protection to the show. For those who love backyard shows — where it’s safe and legal — consider seeking out fireworks with biodegradable casings and look for products manufactured without perchlorate and other toxic compounds.