 While the deal was initially for a "one-week dialogue polish", Gottlieb eventually became the primary screenwriter, rewriting the entire script during a nine-week period of principal photography.The script for each scene was typically finished the night before it was shot, after Gottlieb had dinner with Spielberg and members of the cast and crew to decide what would go into the film.Many pieces of dialogue originated from the actors' improvisations during these meals; a few were created on set.