SEATTLE, Wash. (AP) — Lawyers for a group of mentally ill patients settled a federal lawsuit Thursday with the agency that runs Washington state’s two psychiatric hospitals after improvements were implemented to allow the patients to receive more treatment and enjoy more freedom.

Patients who were admitted to the hospitals after being found not guilty by reason of insanity had lost many of their freedoms after a patient with a violent history walked away from one of the facilities in 2009 and the state legislature passed laws that cracked down on these patients.

Spokane lawyer Andrew Biviano and Disability Rights Washington sued the state in 2014, arguing the restrictions violated the patients’ constitutional rights.

The two sides entered into negotiations and reached a settlement in 2016, Biviano said.

The state began implementing changes and Thursday a federal judge approved the settlement and dismissed the case.