During harsh Chicago winters when he was homeless, Glenn Baker used to spend as many as 20 nights each month in local emergency rooms–both because of his chronic medical conditions and, at times, just to get out of the cold. But for the last year and a half, Baker has lived in his own apartment , paid for in part by the University of Illinois Hospital. His health has improved, and when he visits the hospital now, it’s usually just to say hello.

In a pilot program, the hospital partnered with the nonprofit Center for Housing and Health to provide supportive housing for 26 ER “super users” like Baker beginning in 2015. After seeing the program’s success–on average, healthcare costs per patient dropped 18% each month–the hospital now plans to pay to house 25 more people. It is also working with other hospitals to help them make the same investment.

“We think a combination of things makes a very compelling argument that other hospitals need to do very similar work,” says Stephen Brown, director of preventive emergency medicine at the hospital and of its Better Health Through Housing initiative.

The Center for Housing and Health had studied the impact that supportive housing could have for homeless people leaving hospitals in the past, and saw benefits for patients as well as cost savings; it’s that same logic that inspired a bill proposed in the Hawaii state legislature last year to allow medical practitioners to prescribe housing for the homeless, just as they would medication. A member of the nonprofit’s board worked at the hospital and helped start conversations between the two organizations.

For the hospital, which serves a large number of people living in poverty in Chicago, the program made sense partly because of its growing focus on community health, rather than just the individual care of patients. “In the past, I know this sounds a little stunning, but [hospitals] really weren’t all that concerned about the health of the residents that they serve,” says Brown. “They were really just focused on delivering healthcare.”

The Affordable Care Act, which requires nonprofit hospitals to submit an assessment of community health every three years, helped shift that perspective by bringing more attention to the impact that factors like housing, transportation, and employment have on health.

Being homeless, unsurprisingly, is terrible for health. People without a permanent place to live have a life expectancy that’s 26 years less than the average American’s. For some, a health crisis might be the reason that they lose a job and become homeless; once homeless, managing chronic diseases and taking medicine at the right time (or at all) becomes even more challenging. Living on the street increases the risk that someone will be assaulted. Among chronically homeless people, many suffer from mental illness and addiction. Of the 26 people initially housed through the hospital’s program, four people were so ill that they died, and one entered hospice care.