Detecting and treating the warning signs of mental illness