After months of contemplation, the Legislature has approved and sent to Gov. Charlie Baker a pair of bills overhauling the state’s criminal justice system.

If signed by the governor, the bills (S.2371 & H.4012) will make several sweeping changes to criminal justice laws in Massachusetts.

The governor refused to say what he will do with the bills and said he’s reviewing the compromise legislation.

"It’s a long, complicated bill," Baker said Thursday, of the bigger S.2371, "We’ve got asks out to our agencies to put together briefings and come talk to us about what’s in it, and we’ll have a lot to say about it next week."

So what's in it? Here are seven key provisions:

1. Juvenile Justice

It would raise from 7 to 12 the minimum age a child can be held criminally responsible and tried in juvenile court. Lawmakers contend children entering the criminal justice system at such a young age are less likely to be able to break free of it as they approach adulthood.

"There’s an indisputable link between the age in which a child enters our criminal justice system and the likelihood of a child remaining in the system throughout their life," said House Judiciary Committee Chairwoman Claire Cronin (D-Brockton). "So we’ve taken so many steps that will slow down that trajectory, and I think we’ll see on that end very, very big gains."

2. Bail Reform

Currently, indigent or poor people charged with crimes are often unable to get out of jail prior to trial, because of their inability to pay what would be for more affluent defendants a reasonable amount to ensure future appearances in court.

Under the reform package, a defendant’s ability to pay bail would be taken into account by a judge when bail is set.

3. More Use Of Diversion Programs

The bill encourages district attorneys to create and utilize diversion programs for veterans and people suffering from mental illness, as well as those with substance abuse disorders. The idea is to use the diversion program as an alternative to jail time. (A similar program has been in place for juvenile offenders.) Under a diversion program, a judge would be able to use discretion to allow an offender to do community service or some other program before he or she is arraigned.

Once the program is completed, there would be no record of a criminal charge.

4. Expungement

The legislation would make it easier for people who committed a minor crime before the age of 21 to seal for good that record, provided the individual committed no other crimes. Currently, juvenile records can follow an individual well into adulthood, and can keep people from getting a job or prevented from other opportunities.

In addition to the expungement of criminal records, convictions for acts that are no longer considered crimes in Massachusetts -- including marijuana crimes, now that adult-use marijuana is legal in Massachusetts -- could be wiped away as well.

5. Solitary Confinement And Compassionate Release

The bill puts restrictions on the use of segregation, or “solitary confinement,” in the state’s prison system. Inmates in segregation would have to be given periodic hearings to determine if being isolated from the rest of the prison population should continue. Prison officials would also be prevented from placing juveniles and pregnant women in solitary.

Another provision allows for the compassionate medical release for prisoners who pose no safety risk. This would in effect allow for some elderly or terminally ill state prison inmates to be transferred to less costly care.

6. Elimination Of Mandatory Minimums For Certain Low-Level Drug Offenses

During the war on drugs in the 1980s, laws requiring mandatory minimum sentences for all sorts of drug crimes were adopted. Reform advocates say these laws tied the hands of prosecutors and judges who had no discretion but to issue lengthy sentences, often for drug-dependent people who were only using illegal drugs, or involved in small drug transactions in order to fund their drug habit. They also argue that minorities were often disproportionately given heavier sentences under mandatory minimum laws. Legislators hope with the elimination of certain mandatory minimums, more low-level dealer-users would get the treatment they need, instead of lengthy prison sentences.

7. Fentanyl And Carfentanil Trafficking

While the Legislature is easing up on some drug-related mandatory minimums, they are getting tougher when it comes to fentanyl and carfentanil trafficking. The synthetic opioids can be lethal, even in small amounts, and are contributing to the recent uptick in opioid overdose deaths. Baker has pushed hard for these tougher penalties. Under the law, prosecutors could bring charges against offenders who traffic in any amount of fentanyl and carfentanil. Those convicted of trafficking in the deadly substances would face a three-and-a-half-year minimum prison sentence.