19. [States parties should explain in their reports what they have done to revise outdated laws and practices in the field of mental health in order to avoid arbitrary detention. Any deprivation of liberty must be necessary and proportionate, for the purpose of protecting the person in question or preventing injury to others, must take into consideration less restrictive alternatives, and must be accompanied by adequate procedural and substantive safeguards established by law. The procedures should ensure respect for the views of the patient, and should ensure that any guardian or representative genuinely represents and defends the wishes and interests of the patient. States parties must provide programmes for institutionalized persons that serve the purposes that are asserted to justify the detention. Deprivation of liberty must be reevaluated at appropriate intervals with regard to its continuing necessity. Patients should be assisted in obtaining access to effective remedies for the vindication of their rights, including initial and periodic judicial review of the lawfulness of the detention, and to ensure conditions of detention consistent with the Covenant.