You treat with both nature and nurture.
Nature: For sex offenders, nature can be fixed with castration, either physical or chemical. There are also drugs out there, certain anti-depressants, that work as a sexual-killer for both sexes. Introduce those medications as “anti-Viagra” and unless they are prone to manic episodes give them that. Another solution down the road would be gene therapy. Target the genes that influence the behaviors, feelings and thoughts, and turn them off. Another thing they could do is force rapists to take birth control or surgery to prevent them from reproducing. They don’t reproduce, and you’re less likely to have another generation of sex offenders. Of course, if the sex offender is in a loving relationship and has repented his old ways, I believe that person ought to reproduce. Most if not all of these cases would only apply to the individuals that are the most serious of cases. The kid that shows his junk on a phone wouldn’t be prosecuted this way. As far as non-sexual offenders go, many of these treatments still apply. Many medications don’t get used for what they could be used for. For example, I have bipolar one but when I take invega, it calms my anger problems. I believe that many psychiatric drugs could be off-label for other things. As they say, “there’s a drug for everything nowadays.”
Nurture: Have clinical psychologists and therapists for all cases of severe criminal behavior - not just the ones that are mentally ill. My idea of a jail would be like a place that girl is sent to in “Girl, Interrupted”. I believe that criminal issues should be focused not on punishment (as nature does), but rehabilitation and I strongly think that when it comes to nurture, criminal issues are deep psychological issues. People that are repeat offenders have deep psychological problems that need to be resolved. I would close the for-profit jails and prisons and re-open the decaying mental hospitals and re-brand them as, “psychological criminal units” which people would see therapists, psychologists, and psychiatrists to treat the nurture of their problems. This wouldn’t be like Norway’s prisons - there wouldn’t be computers or wifi. But it wouldn’t be like the jails and prisons we have today either. It would strongly focus on rehabilitation rather than punishment. There would be support group meetings and wings of the units that would focus on one issue (such as violence, financial gain, or sexual abuse) and people would be focused on getting help rather than getting hurt again. There would be support group meetings focused on resolving the issue at hand. Sentences would not be issued by judges or a jury. Instead the time someone is in one of these units would end when the therapist/psychologist, nurse, councilor, social worker, and psychiatrist all feel like it is okay to be released to the real world.
Also, once someone is rehabilitated, there would be no public records of their wrong-doing (similar to cases of mental illness). There would be a private record which judges would be able to access, however. Also, these places would not be for-profit, they would be run by the state.
Sometimes I get the sense that I would make a decent politician… Or at least someone that crafts bills into laws.