Principal Skinner surprises Mrs. Krabappel’s class with a functioning robot. A bored Bart looks out the window and notices a man manipulating the device via remote control. Using an apple, Bart knocks the man from a tree, which causes the robot to run amok. Several days later, the Simpsons take a trip to the Knowledgeum, a museum featuring many “hands-on” exhibits. During the excursion, bullies Jimbo, Dolph, Kearney and Nelson stuff Chief Wiggum’s son, Ralph, into a giant model of the human ear. Marge takes pity on the hapless Ralph. She has a conversation with Wiggum, who describes his son as being very creative. Concluding Ralph may need some friends, Marge pairs the boy with a horrified Bart.

At first, Bart attempts to change his mother’s mind, but his efforts prove unsuccessful. The pair make their way to the Wiggum residence, where Bart discovers a police master key. Excited by the prospects of unlocking every door in town, Bart decides to sleep over at Ralph’s house. That night, he and Ralph steal the key and access several stores. When the pair are spotted by the bullies, Bart shows them the police master key. He convinces the group that the coolest place in town is an abandoned prison.

The bullies steal away the key. Dolph tosses it through a broken prison window and the bullies walk away. Ralph and Bart squeeze through the prison fence bars, but a large rat scoops up the key and runs inside a room containing an old electric chair. Ralph inserts the key into a switch marked “safety” and arms the chair, staging a mock execution. The next day, Bart and Ralph happen upon a press conference on television. Mayor Quimby tells viewers he intends to reopen the prison as a way of sending a message to the criminals of Springfield. To demonstrate his point, he straps himself inside the electric chair. A horrified Bart and Ralph realize they neglected to reset the safety switch. Ralph suggests his imaginary flying-dog friend could fly to the prison with his rocket power. Ralph’s suggestion gives Bart an idea. He attaches a note warning of the danger to a model rocket and aims it towards the prison. But the rocket loses power and crashes into Mr. Burns’ office at the power plant. Burns sees the note and, realizing the old prison has been receiving free electricity for thirty years, kills the power—inadvertently saving Quimby’s life.