Although it’s discouraged by meticulous filmmakers like Stanley Kubrick, improvisation has an interesting place in cinema. The average Hollywood comedy will have a few scenes with semi-improvised riffing – especially since comedy’s biggest stars, like Melissa McCarthy and Bill Murray, tend to come from an improv background – but ad-libbed lines can have a place in drama, too.

RELATED: 10 Movies That Are Wildly Different Than Their Original Scripts

In fact, some of the most memorable quotes in movie history were unscripted. An actor who’s fully immersed in a scene can often come up with more suitable dialogue than a screenwriter sitting in an office, staring at a blank page, months before the cameras will start rolling.

Bill Murray’s “Cinderella Story” Speech In Caddyshack

Bill Murray at the country club in Caddyshack

Since Caddyshack director Harold Ramis cut his teeth in the same improv circle as Bill Murray, he knew he didn’t need to give his character much scripted dialogue, because the actor would come up with even funnier lines himself on the day.

There was no dialogue in the scene in which he smacks flowers with a golf club. Instead, the entire “Cinderella story” monologue was ad-libbed by Murray.

“I’m Walkin’ Here!” In Midnight Cowboy

Ratso gets angry at a taxicab in Midnight Cowboy

With a limited budget, the producers of Midnight Cowboy couldn’t afford to shut down a New York street, so Jon Voight and Dustin Hoffman had to walk through regular crowds to perform their scenes.

In order to avoid ruining takes, the actors had to incorporate real-life encounters into the scene. When a taxi bumped into Hoffman, he yelled at the driver in character: “Hey, I’m walkin’ here!”

“All Right, All Right, All Right” In Dazed And Confused

Matthew McConaughey as Wooderson in Dazed and Confused

Wooderson has a ton of iconic lines in Richard Linklater’s classic hangout comedy Dazed and Confused, from “It’d be a lot cooler if you did” to “That’s what I love about these high school girls, man – I get older, they stay the same age.”

But arguably his most memorable is “All right, all right, all right,” a phrase that is known to people who haven’t seen the movie and inextricably tied to Matthew McConaughey as a sort of catchphrase. McConaughey improvised the line after he’d heard Jim Morrison say “all right” a few times in quick succession between songs on a live Doors album.

“Funny How?” In Goodfellas

Joe Pesci in Goodfellas

During the shooting of the early nightclub scene in Goodfellas, Joe Pesci mentioned that he’d witnessed a similar encounter between mobsters when he was working as a waiter at a restaurant patronized by the mafia, so Scorsese let him run with the scene.

Pesci’s character Tommy tells a story and Ray Liotta’s character Henry tells him he’s a “funny guy.” Tommy challenges Henry until Henry finally catches on that he’s messing with him.

“I Know” In The Empire Strikes Back

Han Solo saying 'I know' to Leia on Bespin in The Empire Strikes Back

In the original script for The Empire Strikes Back, as Han Solo was being frozen in carbonite and Princess Leia told him, “I love you,” he was supposed to say, “I love you, too.”

RELATED: Star Wars: 10 Ways The Empire Strikes Back Is The Saga's Best Movie

However, Harrison Ford didn’t think this was very characteristic of Han and decided to change the line to “I know,” which has since become one of the Star Wars saga’s most iconic quotes.

“Heeeere’s Johnny!” In The Shining

Jack's grinning face peeking through a hole in the door in The Shining

For the scene in Stanley Kubrick’s The Shining, in which Jack Torrance hacks at the bathroom door with an ax in a bid to murder his wife and son, Jack Nicholson threw in Ed McMahon’s catchphrase, “Heeeere’s Johnny!”

It’s since become one of the most-quoted lines in the history of horror cinema. Kubrick almost cut it because he lived in the UK where The Tonight Show didn’t air, so he didn’t understand the reference.

“...Take The Cannoli” In The Godfather

Richard Castellano at the wedding in The Godfather

According to The Hollywood Reporter, the original script for The Godfather simply had Clemenza telling Rocco, “Leave the gun.” Richard S. Castellano improvised the second part: “Leave the gun, take the cannoli.”

This was based on a suggestion by Castellano’s wife, Ardell Sheridan, who thought it would be fun to call back to the character’s reference to dessert in an earlier scene.

“You Talkin’ To Me?” In Taxi Driver

Robert De Niro talks in front of a mirror in Taxi Driver

Paul Schrader’s script for Taxi Driver simply noted that Travis Bickle talked to himself in the mirror. It didn’t specify what his actual lines would be, so Robert De Niro was free to improvise.

RELATED: Taxi Driver: 10 Reasons Travis Bickle Is The Quintessential Antihero

He started repeating the line, “You talkin’ to me?” and eventually started threatening the imaginary man in the mirror, highlighting the character’s intense isolation. This has since become one of the most renowned moments in movie history.

“Yippee-Ki-Yay, Motherf***er” In Die Hard

John McClane saying 'Yippee ki yay' in Die Hard

Screenwriter Steven E. de Souza said that in his script for Die Hard, he wrote John McClane’s now-beloved catchphrase as “Yippee-ki-yay, a**hole!” After saying the line as scripted a few times, Bruce Willis changed it to “motherf***er.”

However, he didn’t intend for this to be taken seriously – he just wanted to give the crew a chuckle. The studio reluctantly left it in for the first test screening, the audience loved it, and the rest is history.

“Here’s Looking At You, Kid” In Casablanca

Rick says 'Here's looking at you, kid' to Ilsa at the end of Casablanca

“Here’s looking at you, kid” is now synonymous with Casablanca, but it didn’t appear in the original script. Humphrey Bogart improvised the line during one of the flashback scenes.

The writers liked the line so much that they included it in a handful of other scenes, making it Rick’s catchphrase and solidifying it as one of cinema’s most quotable lines.

NEXT: Casablanca: 10 Most Romantic Quotes From The Classic Movie