A number of scenes were improvised; Walsh's "personal touches go beyond the script." When Cody and his gang hide out in their cabin just after the train heist, Cody has one of his "debilitating headaches", causing him to fall from his chair and fire off a round from his .45. This was Walsh's idea, as was the showing of Virginia Mayo's upper thigh on screen. Another scene involved Cody giving his wife, Verna, a "seething look", but Walsh improvised and had Cagney knock her off of her chair. Cagney claimed it was his idea "to have Cody climb onto Ma Jarrett's lap and sit there; being soothed during one of his psychotic ", but Walsh has always denied this; claiming many years later that it was his idea.