
589 A.2d 444 (1991)
STATE of Maine
v.
Boyd BROOKS, Jr.
Supreme Judicial Court of Maine.
Submitted on Briefs January 30, 1991.
Decided April 9, 1991.
*445 Michael E. Povich, Dist. Atty., and Carletta Bassano, Asst. Dist. Atty., Machias, Me., for plaintiff.
William Ferm, Ferm, McSweeney & Collier, Ellsworth, for defendant.
Before ROBERTS, WATHEN, GLASSMAN, CLIFFORD, COLLINS and BRODY, JJ.
BRODY, Justice.
Boyd Brooks, Jr. appeals from an order entered by the Superior Court (Washington County, Smith, J.) denying his motion for resentencing brought pursuant to M.R. Crim.P. 35. On appeal, Brooks claims error in the State's calculation of presentence detention credit pursuant to 17-A M.R.S.A. § 1253(2) (Supp.1990) and challenges the court's conclusion that a Rule 35 motion is inappropriate for correcting error in presentence detention credit calculations. Although we agree with the Superior Court that a challenge to the State's calculation of presentence detention credit should not be raised in a Rule 35 motion for correction or reduction of the sentence, we vacate the order and reach the merits of Brooks's appeal in the interest of judicial economy.
Brooks was first arrested on July 28, 1986 and charged with burglary for breaking into a home with the intent to terrorize the occupants. Bail was set, a bond was posted and Brooks was released from custody the following day. On October 9, 1986, Brooks was indicted on charges of burglary, 17-A M.R.S.A. § 401 (1983 & Supp.1990), terrorizing, 17-A M.R.S.A. § 210 (1983), criminal trespass, 17-A M.R.S.A. § 402 (1983), and criminal mischief, 17-A M.R.S.A. § 806 (1983), in connection with the July 28, 1986 incident. Brooks spent a total of one day in jail prior to sentencing on the charges contained in the October 9, 1987 indictment and the State has certified that he should be given one day of presentence detention credit.
Brooks was arrested a second time on April 16, 1987, this time for operating a motor vehicle after being determined an habitual offender. While at the police station being booked on the charge, Brooks bit the booking officer on the nose. He was, nonetheless, allowed to leave after he had been booked. Brooks was indicted on the traffic offense, 29 M.R.S.A. § 2298 (Supp. 1990), and also for assaulting the booking officer, 17-A M.R.S.A. § 752-A (1983 & Supp.1990), on May 7, 1987. The record indicates that Brooks spent less than 24 hours in custody in connection with the May 7, 1987 indictment.[1]
On May 5, 1987, Brooks was arrested for a third time. This arrest involved a manslaughter charge factually unrelated to the previous charges. Brooks was arraigned on the manslaughter charge on May 20, 1987 and bail was set but because Brooks was unable to make bail, he remained in custody on this charge until he was sentenced on July 11, 1988a total of 433 *446 days. The State has certified that Brooks should receive 433 days of presentence detention credit in connection with the manslaughter sentence.
While being questioned by the police regarding the manslaughter charge, Brooks confessed to a liquor store burglary committed on May 5, 1987. He was indicted on a charge of burglary, 17-A M.R.S.A. § 401, on September 10, 1987. At the time of his arraignment on this charge, Brooks was already in jail on the manslaughter charge, no bail was set and Brooks remained in custody. The State did not credit Brooks with any time for presentence detention credit in connection with this offense.
In July 1988, Brooks entered into a plea agreement with the State in which he agreed to plead guilty to the burglary and terrorizing charges contained in the October 9, 1986 indictment in exchange for the State's promise to drop the two remaining counts. As part of the same agreement, Brooks agreed to plead guilty to the traffic violation and the assault charge contained in the May 7, 1987 indictment as well as the burglary charge contained in the September 10, 1987 indictment. Presentence detention credit was not a subject of the plea negotiations. The agreement provided that Brooks would be sentenced to a maximum term of five years on each of the charges to which he pleaded guilty, except for the terrorizing charge for which he would receive 365 days, all terms to run concurrently. The manslaughter charge was not part of this plea agreement and was handled separately.
Brooks' guilty pleas were accepted by the court during a hearing held pursuant to M.R.Crim.P. 11. Brooks does not contend that there were any defects in the Rule 11 proceeding. In accordance with the plea agreement, Brooks was sentenced to a term of five years on the burglary charge and 364 days on the terrorizing charge contained in the October 9, 1986 indictment; five years on the traffic violation and five years on the assault charge contained in the May 7, 1987 indictment; and five years on the burglary charge contained in the September 10, 1987 indictment. The court ordered that all of these sentences would run concurrently with one another and consecutive to the eighteen year sentence Brooks received on the manslaughter charge. The matter of presentence detention credit was not discussed at the Rule 11 and sentencing hearing, except that the presiding justice mentioned that Brooks was entitled to credit for the time he had already served.
This matter comes before us on appeal of an order denying Brooks's motion challenging the State's calculation of presentence detention credit. The motion was brought pursuant to M.R.Crim.P. 35. The court denied the motion on the grounds that Rule 35 is not the appropriate procedural mechanism through which to raise such a challenge. We agree.
Rule 35 sets forth the procedure for correcting or reducing sentences which are either illegal, imposed in an illegal manner or based upon mistakes of fact.[2] Rule 35 is designed to operate in conjunction with other forms of relief available to criminal defendants including appeals of sentences pursuant to M.R.Crim.P. 40, direct appeals pursuant to M.R.Crim.P. 37, post-conviction review pursuant to M.R.Crim.P. 65-78 and executive commutation. Cluchey & Seitzinger, Maine Criminal Practice § 35.1 (1990).
*447 Prior to 1980, Rule 35(b) contained the procedures governing post-conviction review. The post-conviction procedures are now found in Rules 65-78. Under the pre-1980 rules, a criminal defendant who claimed that he had been improperly deprived of credit for time served prior to sentencing could seek relief pursuant to the post-conviction procedures outlined in Rule 35(b) or file a petition for declaratory relief in Superior Court. Boutot v. State, 380 A.2d 195, 197 (Me.1977); Reed v. State, 295 A.2d 657, 660 (Me.1972). Under the current rules, such relief should be sought by a motion directed to the sentencing justice, see Wellman v. State, 588 A.2d 1178, 1179 n. 4 (Me.1991), or, if necessary, by the post-conviction procedures outlined in Rules 65-78. Rule 35 is no longer the correct procedural mechanism for challenging the State's calculation of presentence detention credit.
Brooks's attempt to bring his motion within the ambit of Rule 35 by characterizing his concurrent five-year sentences as either "illegal" or "imposed in an illegal manner" due to the alleged miscalculation in presentence detention credit must fail. An "illegal sentence" is one which is not authorized by law, such as when the court imposes a sentence in excess of the maximum term or less than the minimum term authorized by statute. Brooks's sentences are clearly within the minimum and maximum periods authorized by statute. Nor were the sentences imposed in an illegal manner. Examples of sentences imposed in an illegal manner include sentences based upon a poll of the community as to the appropriate term, State v. Blanchard, 409 A.2d 229, 236 (Me.1979), or sentences that penalize the defendant for exercising a constitutional right. State v. Farnham, 479 A.2d 887, 888-89 (Me.1984). Brooks argues that his sentences were imposed in an illegal manner because the application of presentence detention credit, as calculated by the State, has rendered his concurrent sentences unequal in duration. There is no requirement under Maine law that sentences designed to run concurrently must end on the same date. The sentences are neither illegal nor imposed in an illegal manner.
Brooks's contention that his sentences were based upon a mistake of fact must also fail. Rule 35(c) confers upon the sentencing justice "limited authority to correct errors in the foundational facts on which the sentence is based." State v. Emery, 534 A.2d 1317, 1318-19 (Me.1987). Brooks contends that he and the presiding justice were operating under the mistaken assumption that the concurrent five-year sentences would begin and end on the same date. Brooks admits, however, that presentence detention credit was not a subject of the plea negotiations. He also concedes that presentence detention credit was not discussed at the Rule 11 and sentencing hearing beyond the presiding justice's comment that the defendant is entitled to credit for time already served. There is no requirement under Rule 11 that the court inform the defendant of each and every collateral consequence of his plea, such as to what pretrial detention credit he may be entitled. Wellman v. State, 588 A.2d at 1181. We find nothing in the record to support Brooks's assertion that he and the sentencing justice assumed the concurrent sentences would end on the same date even after presentence detention credit had been applied. The record reveals no errors in the foundational facts forming the basis of the sentences imposed by the court.
Although, procedurally, the court was correct in concluding that this matter should not have been raised in a Rule 35 motion for correction of sentence, the court, nonetheless, could have addressed the merits of this dispute. We have often stressed the liberal policy of pleading under the Maine Rules of Criminal Procedure and generally encourage the trial courts to apply the Rules to "secure simplicity in procedure, fairness in administration and the elimination of unjustifiable expense and delay." M.R.Crim.P. 2; State v. Lovejoy, 493 A.2d 1035, 1037 (Me.1985). Pursuant to this policy, trial courts should address the substance of viable allegations notwithstanding deficiencies in pleading whenever doing so will promote the objectives set forth in M.R.Crim.P. 2. In the interest of *448 judicial economy, and because the record would not likely be enhanced by a post-conviction hearing, we address the substance of Brooks's appeal at this time.
Brooks contends that he is entitled to 433 days of credit, not only on the manslaughter sentence, but also on each of the concurrent sentences he received.[3] We disagree.
17-A M.R.S.A. § 1253(2) (Supp. 1990) provides that each person sentenced to imprisonment "who has previously been detained for the conduct for which the sentence is imposed ... shall be entitled to receive a day-for-day deduction from the total term of imprisonment required under that sentence." Under the statute, the defendant must be incarcerated for 24 hours before he is entitled to one day of detention credit. 17-A M.R.S.A. § 1253(2-A) (Supp. 1990). The plain language of the statute makes clear that presentence detention credit is to be calculated based on the time spent in jail in connection with the conduct for which a particular sentence is imposed. When a defendant is sentenced for several unrelated offenses, each offense must be treated separately and the defendant should be given credit for the actual number of days spent in jail prior to sentencing on each specific offense. If, however, the defendant is already incarcerated in connection with another offense, he is not entitled to presentence credit on a subsequent charge if this would result in an award of presentence detention credit greater than the total number of days actually spent in jail. State v. Spearin, 477 A.2d at 1154 n. 5.
Applying the statute, we find that Brooks is entitled to 433 days of credit on the manslaughter sentence because he was arrested on May 5, 1987 and remained incarcerated until sentencing on July 11, 1988. He is entitled to one day of credit in connection with the sentences imposed pursuant to the October 9, 1986 indictment because he was arrested on July 28, 1986 and was not released on bail until the following day. Brooks is not entitled to any presentence detention credit in connection with the sentences imposed pursuant to the May 7, 1987 indictment because, although he was arrested on April 16, 1987, he was released the same day and by the time he was formally "committed" on the charges contained in the May 7, 1987 indictment on May 20, 1987, he was already incarcerated on the manslaughter charge. Likewise, Brooks is entitled to no credit for the September 10, 1987 indictment because he was already in custody on the manslaughter charge. Brooks is entitled to a total of 434 days of presentence detention credit.
The entry is:
Order vacated. Case remanded to Superior Court with instructions to enter an order consistent with the opinion herein.
All concurring.
NOTES
[1]  The State certified that Brooks spent a total of 418 days in jail prior to sentencing in connection with the May 7, 1987 indictment and credited him 418 days of credit. The State's calculation was based on the fact that Brooks was formally "committed ... for inability to furnish bail" on the charges contained in that indictment on May 20, 1987. However, Brooks was already in jail on May 20, 1987 on an unrelated manslaughter charge and should not have received any credit for presentence detention in connection with the May 7, 1987 indictment. See State v. Spearin, 477 A.2d 1147, 1154 n. 5 (Me.1984).
[2]  Rule 35 provides in pertinent part:

(a) Correction of Sentence. On motion of the defendant or the attorney for the state, or on the court's own motion, made within one year after a sentence is imposed, the justice or judge who imposed sentence may correct an illegal sentence or a sentence imposed in an illegal manner.
.....
(c) Reduction of Sentence After Commencement of Execution.
(1) Timing of Motion. Within one year after a sentence is imposed and before the execution of the sentence is completed, on motion of the defendant or the attorney for the state, or on the court's own motion, the justice or judge who imposed sentence may reduce a sentence.
(2) Ground of Motion. The ground of the motion shall be that the original sentence was influenced by a mistake of fact which existed at the time of sentencing.
[3]  If Brooks's contention were correct, which it clearly is not, he would be entitled to a 433 day reduction on the eighteen year manslaughter sentence plus a 433 day reduction on each of the concurrent five-year sentences he received on the other charges. The 365 day sentence for terrorizing would be wiped out completely. We have reviewed the Massachusetts authority Brooks cites in support of his position but we find absolutely no support for such a result under either Massachusetts or Maine law.
