Could an iPhone app really be the solution to bad dreams? Yes, according to a two-year sleep experiment conducted by psychologists at the University of Hertfordshire in England.

The free app, called Dream:ON, allows users to basically craft their perfect dream by choosing from over 40 different “soundscapes” to play as they sleep. You can take a walk in the woods, relax on the beach or even be transported to the Wild, Wild West.

“When you dream you are blind, but can still hear your surroundings,” explains app developer Richard Wiseman, a psychology professor at the University of Hertfordshire and author of Night School. “You often integrate sounds into your dreams, and the app takes advantage of this process.”

To come up with all the different soundscapes, Wiseman and his team asked 1,000 people to describe their ideal dream. “We then based the soundscapes around the most popular topics,” he says—which fully explains why “50 Shades of Grey” is an option, which features lots of heavy breathing and sexual sounds! “The results suggest that the nature-based soundscapes produce more relaxing dreams, and the cityscape produces more bizarre ones.”

After analyzing millions of dream reports, researchers also found that those who chose a nature soundscape, like “Relaxing Rainforest,” or “Peaceful Garden,” were more likely to dream of greenery and flowers, whereas those who chose a beach soundscape, like “Ocean View,” or “Pool Party,” were more likely to dream of feeling the sun on their skin.

So how does the app work, exactly? It doubles as an alarm clock, so before hitting the hay, you simply select your desired soundscape, indicate when you’d like to wake up and place your iPhone at the corner of your actual bed, making sure it’s not buried underneath a pillow. Dream:ON monitors your movements 20 minutes prior to being woken up by the alarm. If it detects a lack of movement, indicative of dreaming, it will play your selected soundscape. Once you start moving again, however, a gentle alarm will sound and prompt you to submit a short description of your dream.

The app targets the last dream that you have before you wake up because it dictates your mood in the morning, points out Wiseman. “Having positive dreams helps people wake up in a good mood,” he says. “In principle, Dream:ON may also help with depression by changing the emotional tone of people’s dreams.”

To see if the app would actually work, I decided to test it out myself. The first night I selected the “Ocean View” soundscape and wound up with a really rad dream about an awesome lake vacation. The second night I went with the “Paparazzi” one and found myself breaking it down at the club.Want to take a vacation or live the highlife in your dreams? You can download Dream:ON for free exclusively on your iPhone.