As anyone who enjoys trying to crack a joke knows, humor is hard. The deconstruction of its elements is about as amusing as an autopsy. When I was initially writing my sci-fi comedy Offlining, and then going back to it every few years over the past decade, what I rewrote the most was the schtick. What kept me from publishing it long ago was the desire to make it funnier. What I worry about most in reviews to come is that readers will say it isn’t funny enough.

From the absurd product placements I put in this near-future “pre-apocalypse,” such as the Aiken’s Diet, where your body serves as the host organism to a mutant tapeworm (Fastest weight loss EVER™), to coming up with the evangelist villain’s schemes to commercialize the Almighty, including a memoir titled God’s Plan, Part One—What He’s Told Me So Far, my job on every page or two was to find the funny.

You don’t have to be writing a humorous story, though, to introduce comedic elements. Any work can benefit from some levity. Even in Hardscrabble Road, a novel about overcoming poverty and abuse, the boys’ interactions were sometimes slapstick because that’s how kids are. I tried to lighten the tone a bit more in Return to Hardscrabble Road, which was called “a truly great comic novel,” by the truly great Philip Lee Williams, who added, “It has been years since I’ve laughed so much.” Either I overdid the comedy in the sequel, or Phil has an even more twisted sense of humor than I do.

Humor engages your readers. When comedy works, it’s because the jokes are unpredictable—exactly what you need on occasion to surprise readers and keep them off-balance. A reader who’s uncertain about what’s going to happen next is one who will continue reading.

Even when your situation is serious, it helps to have a character with an odd perspective who has a flippant way of looking at things. Bo’s producer Jeff in my kidnapping thriller Watch What You Say gets all the best lines because of his warped worldview, where nothing is sacred, and everything is ripe for a smartass quip. For example, when comparing stories with Bo and another character about why they were given their first names, Jeff says he was “named after my mom’s favorite brand of peanut butter. Her spelling sucked.”

If you don’t possess that kind of skewed viewpoint, you probably have a friend or family member who does. Have them read a section of your manuscript that seems to call for a little touch of humor to break up the steady downbeat mood or unrelenting tension and suggest some possible comedic moments or comments. Even if none of those ideas are keepers, they might tilt your axis enough that you’ll find the perfect eccentric observation, which will bring some lightness to a prolonged stretch of gloomy scenes.

Also, read authors who demonstrate a good sense of humor: Janet Evanovich, Paul Beatty, and John Scalzi among them. You can find plenty of other recommendations from your local bookseller and online. Study the way these writers set up a comedic scene or remark and then how they pay it off. After a while, you’ll sense the rhythm of the “beats”—setup and punchline—and can make that “jocular jazz” your own.

Few things in entertainment are more idiosyncratic than comedy. A schtick that’s patently funny to you is likely to upset someone else for reasons beyond your control. There are people who insist they have a good sense of humor but are spring-loaded to find offense. There’s nothing you can do about this except ignore their vitriolic reviews and hope your work finds readers who appreciate a good joke. Make ’em laugh, and the readers who appreciate the funny will find you soon enough.