Forty years ago, our society changed the way it treats people with mental illness, a change that stemmed from the best of intentions, but has in some ways hampered treatment for people in need.

If you remember the movie “One Flew Over the Cuckoo’s Nest” (or the book, if you still read), it painted a bleak picture of what then were basically insane asylums. In an effort to provide help in settings more conducive to a patient’s recovery, we sought to deinstitutionalize mental health treatment.

Here we are, 40 years later, and there were essentially the same number of beds in the Utah State Hospital as there were in 1980, five years after Cuckoo’s Nest hit theaters, while the state’s population has doubled.

Last fall, I wrote about a patient at the hospital who was originally sent there in 1983 after being deemed incompetent to stand trial on burglary and manslaughter charges. He was eventually released but landed back in the hospital after being charged with kidnapping and attempted murder.

He spent 20 years there and was slated to be released again, until it was decided to keep him until appropriate community resources could be identified.

The problem is the state hospital is constantly at capacity, both with patients sent there for having committed a crime and those people civilly committed who just need help, forcing the folks who run the hospital to make hard decisions about who is most desperately in need of a bed.

Meantime, the prison and jail population has nearly tripled over the past four decades.

The result, says Rep. Steve Eliason, R-Sandy, is that “we’ve reinstitutionalized people and instead of treating them in a clinical setting, it’s a criminal setting.”

Eliason is sponsoring legislation this session to change that. His proposal, which was backed by Gov. Gary Herbert in his budget last week, would add 30 beds at the Utah State Hospital, at a cost of about $4.9 million.

It’s an important move that could alleviate some of that pressure and, more importantly, ensure that those people who really need to be treated in an inpatient setting can be.

Eliason’s plan would also beef up so-called “wrap-around services” for about 100 patients, providing them with case management and assistance from a psychologist, nurse and social worker. It also includes a housing voucher to ensure people discharged from the hospital don’t end up homeless — “throwing the bird out of the nest.”

There’s another important piece of the potential solution being proposed by Rep. Brad Daw, R-Orem, aimed at helping to make sure inmates released from jail are eligible to receive the medical or mental health treatment they need.

A few months ago I wrote about a man who had bounced in and out of the county jail 123 times and everyone I talked to about these types of cases said the challenge becomes making sure these people are able to get the help they need once they’re no longer behind bars.

The problem arises because inmates can’t sign up for Medicaid coverage until they get out of jail, creating a perilous period for those who still need treatment.

Last August, New York submitted a request to the Centers for Medicare and Medicaid Services for a waiver to let that state enroll inmates in Medicaid before they are due to be released.

The New York waiver is pending but is expected to eventually be approved. Daw’s bill would follow the lead, requiring Utah officials to seek similar approval — which could be almost automatic if New York’s gets the go-ahead.

Daw says that would enable there to be a “warm handoff” of inmates who still need care. “Being on Medicaid, they have a much better chance of getting continuing treatment outside of the jail,” he said.

These are just a few of the measures looking to fix a challenged mental health system. Add in five new mobile crisis units for rural counties; a transition facility for inmates with mental health needs; short-term, no-refusal crisis centers; and grants to train mental health professionals and Utah could patch many of the holes in its social safety net, tackle some of the root causes of recidivism and homelessness, and potentially become a national leader in how we treat those in need of help.