The Murphy Bed, also known as a wall bed, fold down bed or pull down bed, is a bed that’s hinged at one end so it can be folded up and stored vertically against a wall or in a closet. It’s useful in situations where floor space is at a premium, like studio apartments, dorm rooms, mobile homes and cruise ship cabins.

The bed is named, no surprise, after a guy named Murphy—William L. Murphy.

These kinds of beds had already been around in other forms for a while. Thomas Jefferson had his beds in Monticello hanging on ropes and hooks in the alcoves of the bedrooms, and Leonard Bailey received the first patent for a folding bed in 1899. Murphy’s innovation was at the bed’s point of folding. Using an old closet doorjamb and some door hinges, he built a pivot that allowed the bed to attach to a wall and fold up against it for easy storage.

The son of a gold-seeking 49er, Murphy worked a few different jobs around California before he came up with his invention. He broke in horses for a while, drove a stagecoach, and even served as sheriff of a little pioneer town. At the turn of the 20th century, he made his way to San Francisco and rented a tiny one-room apartment on Bush Street, which inspired his leap into the bed business.

Know When to Fold 'Em

The Murphy Bed Company says that Murphy’s standard bed took up most of the apartment’s floor space, which made having company a little difficult. Murphy wanted to entertain his friends at his home, so he began toying around with the folding bed idea.

As Gene Kolakowski, an executive at the company, told CBS News, though, there’s an alternate origin story where Murphy’s incentive was much greater. The version that Murphy’s descendants like to tell is that he designed the folding bed because he wanted to have a certain young lady over to his place, but the moral standards of the time deemed it inappropriate to have a woman in his bedroom. Desperate for some quality courting time with the woman, Murphy was inspired to find a way to instantly turn his bedroom into a more innocent living room.

Murphy eventually married that same girl and used a loan from her father to patent the “Murphy In-A-Dor Bed” and start his own company to make them. That same company continues to make them today, almost 100 years later. The beds aren’t as popular as they once were, though. Demand peaked in the early 1900s as manufacturing became the focus of the American economy and people flocked to jobs in urban areas. Disaster in the bed’s hometown caused a spike in sales, too.

After the San Francisco Earthquake and Fire of 1906, the beds were placed in many new and rebuilt buildings to maximize space (according to Gladys Hansen, a curator at the Museum of the City of San Francisco, some of the beds already installed in the city folded up violently during the quake, injuring their occupants and killing at least one).

The Great Depression, the rationing of steel and other raw materials during WWII, and the post-war suburban housing boom all cut into the folding bed business, but the market is still big enough to support Murphy’s original company, plus a few competitors. In 1989 the courts ruled that the “Murphy bed” was no longer entitled to trademark protection because the public had come to see it as a generic term for beds that fold into walls, whether they were Murphy’s design or not.