"Doomsday" is the sixth episode of the eighth season of the American comedy television series The Office, and the show's 158th episode overall. The episode aired on NBC in the United States on November 3, 2011. "Doomsday" was written by Daniel Chun and directed by Troy Miller. The series—presented as if it were a real documentary—depicts the everyday lives of office employees in the Scranton, Pennsylvania branch of the fictional Dunder Mifflin Paper Company. In the episode, Dwight Schrute (Rainn Wilson) programs a device that will fire all of the employees and effectively close down the branch if they make too many mistakes. Meanwhile, Gabe Lewis (Zach Woods) attempts to court the new warehouse worker, Val. "Doomsday" received mixed to positive reviews from critics, with some reviews critiquing the episode's resolution. According to Nielsen Media Research, the episode was viewed by 6.15 million viewers and received a 3.2 rating/8% share among adult between the ages of 18 and 49, marking an increase in the ratings from the previous episode. The episode ranked third in its time slot and was the highest-rated NBC show of the night. Synopsis Robert California (James Spader) confronts Andy Bernard (Ed Helms) about the number of mishaps and blunders made in the office, and gives him a firm directive to "simply end the mistakes." With no ideas on how to make this come about, Andy puts it in the hands of Dwight Schrute (Rainn Wilson), who devises a system to find mistakes made by employees in the office. He programs an "accountability booster" that will forward incriminating emails to California if they make five mistakes in one day, effectively causing them to lose their jobs. The rest of the office are unhappy with Dwight's system, and call it a doomsday device. Despite their best efforts, the group manages to make five mistakes barely halfway through the first day with the system, and Dwight reveals that the emails will be automatically sent to California at 5:00 pm. Andy, along with the other office workers, pleads with Dwight to deactivate the system, but Dwight refuses, belittles the rest of the office staff for being so careless, and retreats to Schrute Farms. The office formulates two plans to save their jobs. Jim Halpert (John Krasinski) is tasked with tracking down Robert at a squash court and intercepting the emails before California has a chance to view them, while Andy,