In voiceover, Earl complains that he keeps getting "trapped". After getting locked in the bathroom he heads to the Crab Shack where he has to endure Slow Roger drone on about his favorite movies. Locked in his car afterwards, he realizes that karma is trying to tell him something. Months before, he'd assisted Joy in an accidental kidnapping where the pair had locked a man, Josh, inside Joy's truck.
To make amends, Earl decides to give Josh a free massage courtesy of Tammy, Camden's only "legit" masseuse. However, when Randy and Earl arrive at the man's apartment, they find him dead, the victim of an accident in a retractable bed. The death saddens Earl but brightens up Joy, who sings "Ding Dong, the witch is dead!" Meanwhile, Randy tells Earl that he needs a new apartment for his pretty new "green card wife", Catalina.
To get back his karma, Earl decides to pay his respects at Josh's funeral. At the funeral home, he and Randy encounter a kooky manager who props his victims up in weird costumes. They discover that nobody has claimed the body. A subsequent trip to Josh's building reveals that his neighbors don't care, either. Randy and Catalina continue their apartment search.
Earl crosses Josh off his karma list but can't sleep at night. Josh comes to him in a dream, begging Earl to give him a respectable funeral. He returns to the funeral home and asks the funeral home manager for a dignified and respectable box. Joy offers an old suit of Darnell's to bury the corpse in. Earl invites all of Camden to the funeral.
The funeral is a disaster. Guests prop a cigarette in the corpse's mouth and Darnell complains to Earl that his prized wedding suit is being worn by a dead man. Earl promises to return it to Darnell after the reception. In the bathroom, he practices his eulogy.
Returning to the funeral, Earl is furious to discover a full-blown party. His eulogy is interrupted by a falling casket and he orders everybody out. Later that night, Josh comes to Joy in a nightmare sequence. Ravaged by guilt, she confesses to Earl that they ought to throw Josh a proper funeral.
Combing through Josh's apartment, Joy and Earl discover he has a circle of friends on the worldwide web: poker friends, music buddies and a dinner companion in India. They contact Josh's friends and most of them show up for the respectable funeral he asked for. Catalina and Randy are now the proud new owners of Josh's old apartment.