Tom Stoppard's 1960 play Rosencratz and Guildenstern are Dead takes two of Hamlet's background characters, Rosencratz and Guildenstern, and gives them a backstory. Throughout the play, Stoppard takes scenes from the original Hamlet and adds in his own storyline for Rosencratz and Guildenstern in between the Hamlet scenes in which they appear.
This adaptation can be confusing at times to read as the characters stumble through circular logic and logical fallacies while they basically accomplish nothing. However, the play is an entertaining read and does a good job of explaining what Rosencratz and Guildenstern could have been doing during the times that they do not appear on stage in Hamlet.
The movie adaptation of the play is cool to watch as well (the 1990 film)