We’ve all experienced vivid, sometimes frightening dreams that cause our heart rates to spike, limbs to twitch, and leave us feeling unrested in the morning. Maybe you were being chased by a giant crab in a top hat, or perhaps your ex shared that embarrassing photo of you with your entire office. Whatever it is, strange dreams leave a solid impression that will often last beyond the following day.

For the most part, all of our dreaming happens for about two hours a night during Rapid Eye Movement (REM) sleep. According to Psychology Today, during REM sleep, signals are sent from the pons, an area near the base of the brain, to the thalamus, and then the cerebral-cortex, an area responsible for learning, thinking and organizing information. What then happens is a dream, or what some scientists believe is our mind’s attempt to organize all of the random impulses being sent out during REM sleep. As a result, the random disarray of information makes for some strange nighttime experiences, inducing nightmares and other frightening occurrences.

But can certain things, like food or medications impact REM sleep, and thus affect the content of our dreams? To find out, click "view slideshow" above.