Sex doesn’t stop when you leave your 20s and 30s, but from the way some people talk about it, you’d think it does. The idea of middle-aged and older people having sex is often treated as a punchline, but it’s not so funny when you’re the one who’s getting a little over the hill.

But here’s the good news: There’s no reason your sex life has to decline as you grow old.

Changes as we age

As we age, our body changes in ways that may make it more difficult to engage in and enjoy sex.

In women, hormone fluctuation, particularly after menopause, causes not only mood swings and the infamous “hot flashes,” but also vaginal dryness, making it difficult to achieve natural lubrication. The vagina actually changes its shape, becoming shorter and narrower, and the vaginal walls typically become stiffer. This can mean discomfort or even pain during sex.

In men, the predominant issue that coincides with age is erectile dysfunction (ED), the inability to get or maintain an erection, most often due to decreased testosterone or prostate issues. Erections may take longer to achieve, be less firm or not last. Erectile dysfunction is incredibly common, affecting 26 percent of men under 40, and 45 percent of men ages 65 to 74.

Many medical problems become more common with age, all of which can contribute to problems between the sheets: arthritis, dementia, incontinence, mastectomies, prostatectomies, heart problems, stroke, depression and medications. Aging people also experience changes in physical appearance—such as wrinkles, graying hair and sagging skin—that can decrease self-confidence and lead to withdrawal.

The hidden benefits of aging

While it may seem that age steals one good quality after another, a number of advantages also come with growing older. For example, after menopause, women no longer need worry about birth control if they’re having sex with men.

Another important consideration is that as you grow older, you also become wiser with experience, and that often makes it easier to communicate honestly and openly.

If you’re in a long-term relationship, all those years bring a much deeper understanding of your partner and their needs.

How to respond

How you meet these challenges depends on your goals. Ask yourself, is staying sexually active important to you? For many married men and women, it simply isn’t; their relationship has moved into a different kind of bond. How you express your passion and affection for another person can be displayed in many different forms.

If you do want to have sex, communication is key. Honesty with your partner is more important than ever. Once you open up, you can think out of the box to reach your bedroom goals, or even create new ones.

Women experiencing vaginal dryness should try a water-based lubricant or lubricating condoms. For problems with ED, men have a number of options, beginning with medications such as sildenafil (Viagra), tadalafil (Cialis) or vardenafil (Levitra). Issues related to flexibility and joint pain can be addressed with pillows or even sex furniture specially designed to provide support.

If one partner is interested and the other isn’t, it’s imperative both are understanding. “Solo performances” can be an alternative, and the non-active partner shouldn’t feel guilty or judged.

Staying single

For single men and women, the options are much the same.

As you grow old, you may want to direct your energy into activities like volunteering or group hobbies, and that’s a great way to meet like-minded people. If you want to start pursuing a romantic life, there are ways to hook up with other seniors online. With or without a partner, the internet has made it easier than ever to buy and enjoy sexual videos, toys and games.

Be sure to consult with your doctor about any problems or concerns you may have, and there’s no need to be embarrassed and censor your symptoms or feelings, because they’ve heard it all before.

Your sex life—solo or accompanied—does not have to go down the tubes just because you’re getting older. With some creative thinking, there are many possibilities to keep sex fun and achieve your goals in the bedroom.