Homelessness has slowly and steadily declined in the U.S. the past decade, from 647,258 in 2007 to 549,928 last year, according to the federal Department of Housing and Urban Development.

The improvement has been uneven. Western states, including California and Washington, saw significant increases from 2015 to 2016, and homelessness jumped 14 percent in the District of Columbia in that one year.

Eastern states, including New York and Massachusetts, saw big declines, and New Jersey was among them — a 12 percent drop in the annual survey. Atlantic, Cape May, Cumberland and Ocean counties all had similar decreases.

Some of this decrease in homelessness is a result of the slow, steady improvement in the economy since the severe recession of 2007-09. Some is the cumulative effect of raising awareness and helping the homeless, and two recent examples in South Jersey show how it’s done.

At the end of last month, a cardboard box sleepout at the Lighthouse Church in Middle Township gave families a good venue for learning about and discussing homelessness, while raising some funds to help those without a place to sleep.

The inaugural event of Cardboard Box City was a small part of the good work done by Family Promise, a partnership of 37 religious congregations in Cape May County.

They provide overnight shelter on a rotating basis for those in need, and help individuals and families get back on their feet after what is often a temporary crisis.

Over in Cumberland County, the tragic death of a man in 2013 prompted the development of a program to keep the homeless safe in adverse weather conditions.

The county opened warming shelters in Bridgeton, Millville and Vineland, and implemented an organized, weather-triggered response to get the homeless into the shelters to keep them safe.

The familiar Code Blue alert that municipalities issue to protect the homeless is done countywide when a temperature of 25 degrees or less is forecast, or 32 degrees with precipitation, or a wind chill of zero for at least two hours.

The program quickly became a model, and a bill to require all New Jersey counties to follow suit started getting legislative approval in January. On Friday, the governor signed it into law.

It requires county and municipal emergency managers to work together on the planning and execution needed to ensure at-risk people get into shelters in severe weather. The law also establishes something of a shield from liability for religious institutions, nonprofit organizations and volunteers who provide good-faith services in warming centers.

Everyone likes and needs the comfort of shelter on a bitter night.

And everyone can take comfort in these diverse and slowly succeeding efforts.