balancing public safety and mental health in sentencing