
709 N.E.2d 980 (1999)
304 Ill. App.3d 294
237 Ill.Dec. 511
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Dennis L. PULLEN, Defendant-Appellant.
No. 3-97-0867.
Appellate Court of Illinois, Third District.
April 16, 1999.
Peter A. Carusona, Office of the State Appellate Defender, Ottawa, for Dennis L. Pullen.
John X. Breslin, Deputy Director, State's Attorneys Appellate Prosecutor, Ottawa, Marc Bernabei, State's Attorney, Princeton, Terry A. Mertel, State's Attorneys Appellate Prosecutor, Ottawa, for the People.
Justice LYTTON delivered the opinion of the court:
The issue presented in this case is how a trial court determines the maximum length of consecutive sentences: (1) by the class of felony of which the defendant is convicted, or (2) by the class of felony for which he is sentenced. We conclude that the maximum length of consecutive sentences should be measured by the class of felony for which the defendant was convicted. See People v. Ritchey, 286 Ill.App.3d 848, 222 Ill.Dec. 439, 677 N.E.2d 973 (1997). We reverse and remand for further proceedings.
At the guilty plea hearing, the prosecutor informed the court that the State and the defendant had agreed on the terms for a guilty plea. Under the terms of the agreement, the defendant would plead guilty to all five counts of burglary. He would then be sentenced to 15-year terms of imprisonment on each count. Three of the burglaries occurred on one day and the two other burglaries occurred on a separate day. Therefore, the sentences for the burglaries occurring on the same day would be concurrent with each other, but consecutive to those occurring on the other day.
The prosecutor also advised the court that although each burglary was a Class 2 felony, each offense was subject to a Class X sentence because of the defendant's prior criminal history. See 730 ILCS 5/5-5-3(c)(8) (West 1996). Therefore, instead of a Class 2 sentencing range of 3 to 7 years' imprisonment, the defendant would be sentenced to a Class X range of imprisonment of 6 to 30 years on each count. See 730 ILCS 5/5-8-1(a)(3), (5) (West 1996).
The court then admonished the defendant that the law was unclear about the maximum possible consecutive sentences he could receive. If he were sentenced under the minimum Class 2 felonies, the maximum could be 28 years' imprisonment; if sentenced under a Class X term, 120 years' imprisonment. After the defendant had been fully admonished, the court accepted the fully negotiated plea. The defendant subsequently filed a motion to withdraw his guilty plea, which the trial court denied.
*981 On appeal, the defendant contends that the trial court erred in denying his motion to withdraw guilty plea because his sentences are void. He argues that the maximum sentence he could have received was limited to the sum of the maximum extended-term sentence for two Class 2 felonies, i.e., 28 years.
The Unified Code of Corrections (Code) mandates that when a defendant is convicted of a Class 1 or Class 2 felony, after having twice been convicted of any Class 2 or greater class felonies in Illinois, the defendant shall be sentenced as a Class X offender. See 730 ILCS 5/5-5-3(c)(8) (West 1996).
But the Code also requires that the aggregate of consecutive sentences shall not exceed the sum of the maximum terms authorized under section 5-8-2 of the Code for the two most serious felonies involved. 730 ILCS 5/5-5-8(c)(2) (West 1996). Section 5-8-2 of the Code allows extended sentences of not less than 30 nor more than 60 years' imprisonment for a Class X felony, and not less than 7 nor more than 14 years' imprisonment for a Class 2 felony. 730 ILCS 5/5-8-2(a)(2), (4) (West 1996).
Here, based on the defendant's prior convictions, the sentencing range for the defendant's Class 2 burglary convictions was properly enhanced to a Class X level. See 730 ILCS 5/5-5-3(c)(8) (West 1996). Thus, the defendant could have been sentenced to not less than 6 nor more than 30 years' imprisonment on each count of burglary. 730 ILCS 5/5-8-1(a)(3) (West 1996). However, since the trial court sentenced the defendant to consecutive sentences, the aggregate of the consecutive sentences could not exceed the sum of the maximum extended-term sentences available for the "two most serious felonies involved." See 730 ILCS 5/5-8-4(c)(2) (West 1996). We must decide whether the "two most serious felonies involved" refers to the Class 2 burglary felonies or the enhanced Class X sentences.
In People v. Olivo, 183 Ill.2d 339, 233 Ill.Dec. 661, 701 N.E.2d 511 (1998), our supreme court recently found that the enhanced sentencing provisions under section 5-5-3(c)(8) of the Code elevated only the sentencing range and not the class of the crime. In that case, the defendant had been convicted of a Class 2 felony and was found eligible for a Class X sentence based upon his prior convictions. The trial court then found him eligible for a Class X extended-term sentence. The supreme court reversed, finding that since defendant had never been convicted of a Class X felony, a Class X extended-term sentence could not be imposed.
Similarly, in this case the "two most serious felonies involved" must refer to the class of the felony of which the defendant was convicted and not the enhanced Class X sentence. The crimes at issue are considered Class 2 for consecutive sentencing purposes. See People v. Ritchey, 286 Ill.App.3d 848, 222 Ill.Dec. 439, 677 N.E.2d 973 (1997).[1] The maximum extended-term sentence for a Class 2 felony is 14 years' imprisonment. 730 ILCS 5/5-8-2(a)(4) (West 1996). The sum of two maximum extended-term Class 2 sentences is 28 years' imprisonment. The trial court erred when it sentenced the defendant to a total of 30 years' imprisonment. A sentence which does not conform to a statutory requirement is void. People v. Arna, 168 Ill.2d 107, 212 Ill.Dec. 963, 658 N.E.2d 445 (1995). Accordingly, we reverse the trial court's order denying the defendant's motion to withdraw his guilty plea and remand this cause for further proceedings.
Because of our resolution of the foregoing issue, we need not address the defendant's remaining contention.
The judgment of the circuit court of Bureau County is reversed and remanded.
Reversed and remanded.
HOLDRIDGE, P.J., and KOEHLER, J., concur.
NOTES
[1]  We realize that our decision conflicts with People v. Perkins, 274 Ill.App.3d 834, 211 Ill.Dec. 422, 655 N.E.2d 325 (1995), but in light of People v. Olivo, we believe Perkins does not state the current state of the law.
