An astronaut stranded on Mars has to hack, like, everything to survive in The Martian, a movie that ought to be shown to all kids, age 11 and up, as pro-STEM propaganda.

Learn biology and you can grow potatoes in rehydrated poop! Learn math and you can navigate a spaceship! Learn chemistry and you’ll know several methods for blowing things up in a peaceful, work-related setting! These are much better arguments for learning math and science than “you’ll use math every day when you’re older” because, honestly, cosine is not a thing I’ve even thought about since the 11th grade.

But because Mark Watney (Matt Damon) is a trained astronaut and a botanist he knows all about growing potatoes in poop and finding ways to “make” more water to grow said potatoes, which will help him stretch his rations when he finds out he’s been left on Mars, alone, probably with no chance of rescue for at least four years. Mark’s crew, who believe he died in an accident while the crew was leaving the planet during a storm, is headed back to Earth, and even NASA, at first, doesn’t know Mark’s alive. With the rations left for the six-person crew and the potatoes Mark grows, he hopes to make it until the next Mars mission arrives in four years — or at least until NASA figures out that he’s alive and how to get him more provisions.

And, of course, food isn’t his only problem. He has to make sure that he has enough oxygen, that the temporary structure where he’s staying never has a breach and that he doesn’t freeze to death. “I’m going to have to science the heck out of this,” Mark says at one point (well, OK, not exactly those words but that’s as close as I can get to the actual quote in print). And that, essentially, is the movie; Mark and others sciencing their way out of problems.

After Mark spends about a month on Mars, NASA officials — the most plot-prominent of whom are played by Jeff Daniels, Chiwetel Ejiofor, Kristen Wiig, Sean Bean and Mackenzie Davis — figure out, by seeing satellite images of moved and cleaned equipment, that Mark is still alive. But there is still no way to contact him — a problem that eventually involves the Jet Propulsion Laboratory and a team there that includes characters played by Donald Glover and Benedict Wong. Eventually — trailers give this away so it’s only a mild spoiler — the crew of Mark’s ship (Jessica Chastain, Michael Peña, Kate Mara, Sebastian Stan and Aksel Hennie), called the Hermes, gets involved in his survival as well. All eventually work together to save the life of their colleague and, one suspects, because every part of orchestrating his survival is kind of the coolest thing ever.

This movie makes science look like the coolest thing ever! OK, I’m sure there’s plenty of unscientific hooey in the movie — there always is in movies of this sort. But what this movie does is make not just the results of the science but the doing of the science fascinating. People working, that’s what we’re watching, people working to do cool things in space. For that reason, and because the movie actually hews more to the PG of PG-13-ness, I actually do think this is a movie that is middle-schooler appropriate (there are some moments of bad language and one very unsexy shot of Damon’s backside). Like Gravity (but not, for me anyway, Interstellar), The Martian captures the wonder of space and discovery but in a way that is more engaging, approachable and joyous than the awe-inspiring but minor-key-toned Gravity regularly was.

And The Martian is funny. Matt Damon does a good job of crafting a character who has the pluck and affability you’d need to have to face this problem and not crumble immediately but who can still have human moments of doubt, frustration and fear. In Mark’s video logs, he gets to crack wise in the kind of sanity-saving way you’d expect a person in his situation to do. Both the Hermes crew and the scientists back on Earth also have a similar sense of humor in approaching their most serious tasks. And, you’d imagine, they’d have to; how else do you deal with the reality of trying to save someone you’ve already had memorials for who is stranded millions of miles away?

Though it clocks in at nearly two and a half hours, The Martian feels well-paced and held my attention throughout. It has a lightness that serves as a good balance to its more epic qualities (pretty renderings of Mars and space, meticulous special effects, literally otherwordly action) and performances that ground the story with humanity. A

Rated PG-13 for some strong language, injury images and brief nudity. Directed by Ridley Scott with a screenplay by Drew Goddard (from the book by Andy Weir), The Martian is two hours and 21 minutes long and distributed by 20th Century Fox.