A defendant is sentenced after pleading guilty or being found guilty by the judge or jury. Petty misdemeanor, misdemeanor and gross misdemeanor sentences are often given at the time a defendant pleads guilty. A judge has discretion regarding the sentence imposed and usually bases the sentence on a combination of the seriousness of the offense and the defendant's criminal history. Sentences for felony level charges are often set on a date after the defendant pleads guilty or is found guilty. Prior to sentencing, a Pre-Sentence Investigation is completed by Community Corrections and recommendations are made to the judge regarding the sentenced to be imposed. Felony sentences are governed by the Minnesota Sentencing Guidelines.