Sullivan's desk and escapes. Sullivan realizes that Costigan knows and erases Costigan's records from police computers. Costigan hands Madolyn an envelope and instructs her to open it if something happens to him. Later, she innocently opens a package Costigan sent to Sullivan and listens to tapes Costello made of himself with Sullivan, causing her to leave Sullivan. Costigan arranges to meet Sullivan on the rooftop where Queenan was killed, then arrests him. Costigan calls Trooper Brown, a friend from the police academy, to substantiate his identity, but Brown pulls a gun on Costigan when he arrives, unsure who is telling the truth. Costigan says that he has evidence tying Sullivan to Costello, and Brown lets him go down the elevator. Upon reaching the lobby, Costigan and Brown are killed by Trooper Barrigan, a friend of Sullivan's who reveals himself to be another spy working for Costello. Sullivan shoots Barrigan dead, allowing him to out Barrigan as the mole while removing suspicion from himself. When Sullivan arrives home after attending Costigan's funeral, Dignam is waiting for him. Sullivan accepts his fate and Dignam shoots him in the head. Cast Production In January 2003, Warner Bros., producer Brad Grey, and actor/producer Brad Pitt bought the rights to remake the Hong Kong film Infernal Affairs (2002) from Media Asia for $1.75 million. William Monahan was secured as a screenwriter, and later Martin Scorsese, who admired Monahan's script, came on board as director. In March 2004, United Press International announced that Scorsese would be remaking Infernal Affairs and setting it in Boston, and that Leonardo DiCaprio and Brad Pitt were slated to star. Pitt, tentatively scheduled to play Sullivan, later declined to play the role, saying a younger actor should play the part; he decided to produce the film instead. Scorsese's associate Kenneth Lonergan suggested Matt Damon, who grew up in Boston, for the part of Sullivan, and Scorsese asked Jack Nicholson to play Costello. Robert De Niro was approached to play Queenan, but De Niro declined to direct The Good Shepherd. Nicholson wanted the film to have "something a little more" than the usual gangster film, and screenwriter Monahan came up with the idea of basing the Costello character on Irish-American gangster Whitey Bulger. This gave the screenplay an element of realism—and an element of dangerous uncertainty, because of the wide-ranging carte blanche the FBI gave Bulger in exchange for revealing information about