
417 Mass. 818 (1994)
633 N.E.2d 399
DOUGLAS McNEIL
vs.
COMMISSIONER OF CORRECTION.
Supreme Judicial Court of Massachusetts, Middlesex.
March 10, 1994.
May 17, 1994.
Present: LIACOS, C.J., ABRAMS, O'CONNOR, & GREANEY, JJ.
Thomas E. Abruzzese for the Commissioner of Correction.
*819 Barry Barkow (Peter Costanza & James R. Pingeon with him) for the plaintiff.
Scott Harshbarger, Attorney General, & Pamela L. Hunt, Assistant Attorney General, for the Attorney General & another, amici curiae, submitted a brief.
John M. Townsend & Melissa J. Garand, for the Sheriff of the county of Berkshire & others, amici curiae, submitted a brief.
GREANEY, J.
We transferred this appeal to this court on our own motion to interpret G.L.c. 127, § 129D (1992 ed.), which provides for the grant of "good conduct credits" to be applied to the sentences of prisoners who participate in certain approved educational, training, and work programs. The precise issue is whether such credits should be applied to sentenced prisoners for their prior participation in approved programs while they were held in custody awaiting trial. The Commissioner of Correction (commissioner) argues that § 129D does not apply to pretrial detainees. The plaintiff, Douglas McNeil, argues for himself, and for similarly situated prisoners, that the statute requires that good conduct credits be awarded to pretrial detainees as well as to prisoners serving sentences, and that, even if such awards are not required by the statute, they are required by the equal protection provisions of the United States and Massachusetts Constitutions. A judge in the Superior Court agreed with the plaintiff on his statutory argument and ordered relief for him and prisoners similarly situated. We conclude that § 129D provides for the earning of good conduct credits only by sentenced prisoners, and that, so interpreted, the statute complies with Federal and State constitutional equal protection guarantees. Accordingly, we vacate the relief ordered in the Superior Court and order the entry of a new judgment.
The background of the case is as follows. The plaintiff filed a complaint in the Superior Court seeking a declaration of rights under G.L.c. 231A, and injunctive relief, requiring the commissioner to award him earned good conduct credits under G.L.c. 127, § 129D, for his participation in approved programs during the period of time he spent in pretrial detention. *820 The plaintiff's original complaint was amended, a record prepared, and cross motions for summary judgment filed pursuant to Mass. R. Civ. P. 56 (a) and (b), 365 Mass. 824 (1974). A judge of the Superior Court denied the commissioner's motion and allowed the plaintiff's.
Subsequently, numerous other prisoners filed pro se pleadings which were docketed as "complaint[s] for contempt" seeking relief similar to that given the plaintiff. The plaintiff filed motions to amend his complaint to (a) add class action allegations; (b) certify a class consisting of all sentenced prisoners who had participated in, or were participating in, programs that would qualify for earned good conduct credits but for the prisoners' participation in those programs while in pretrial detention; and (c) enter partial final judgment on his claims pursuant to Mass. R. Civ. P. 54 (b), 365 Mass. 821 (1974). These motions were allowed,[1] and it was ordered that the sheriffs of the Commonwealth's fourteen counties be joined as necessary parties.[2] Thereafter, at the judge's direction, a preliminary injunction entered ordering the commissioner to credit "all sentenced Massachusetts state prisoners" with the maximum days of earned good conduct credits under G.L.c. 127, § 129D, for each full calendar month of their pretrial detention until the commissioner received sufficient records to determine the actual credit appropriate for each prisoner. A partial final judgment also entered in the plaintiff's favor. A single justice of the Appeals Court entered a stay of the preliminary injunction at the commissioner's *821 request. Proper appeals were taken by the commissioner from the grant of the preliminary injunction and the partial final judgment, and all matters were consolidated in this court for purposes of appellate review.
1. Section 129D provides that prisoners may earn good conduct credits "while confined at a correctional institution of the commonwealth, or any jail or house of correction."[3] The plaintiff argues that the inclusion in § 129D of the reference to a "jail" demonstrates that the provision was intended to include pretrial detainees, because, as the plaintiff contends, "[i]n Massachusetts, a county jail, or the `jail side' of a combined county correctional facility, means the facility or portion of the facility used to hold persons who are awaiting trial, whereas the house of correction, or `house side' of a county correctional facility, is for sentenced prisoners." We analyze § 129D under the general rule that "a statute must be interpreted according to the intent of the Legislature ascertained from all its words construed by the ordinary and approved usage of the language, considered in connection with the cause of its enactment, the mischief or imperfection *822 to be remedied and the main object to be accomplished, to the end that the purpose of its framers may be effectuated." Board of Educ. v. Assessor of Worcester, 368 Mass. 511, 513 (1975), quoting Industrial Fin. Corp. v. State Tax Comm'n, 367 Mass. 360, 364 (1975). We also apply two other principles of statutory construction. First, "where two or more statutes relate to the same subject matter, they should be construed together so as to constitute a harmonious whole consistent with the legislative purpose." Board of Educ., supra at 513-514. Second, "the statutory language itself is the principal source of insight into the legislative purpose." Hoffman v. Howmedica, Inc., 373 Mass. 32, 37 (1977).
We initially note that in our view the plaintiff reads too much into the inclusion of the word "jail" in § 129D. As the plaintiff acknowledges, G.L.c. 126, § 4 (1992 ed.), provides that jails are used both "for the detention of persons charged with crime and committed for trial," and for those "committed pursuant to a sentence upon conviction of crime." See also G.L.c. 127, § 21 (1992 ed.) (permitting the classification of "prisoners sentenced and committed to jails and houses of correction"); G.L.c. 279, § 33A (1992 ed.) (directing judge to credit pretrial detention time "on imposing a sentence of commitment to a correctional institution of the commonwealth, a house of correction, or a jail").[4] Determination whether § 129D was intended to apply to pretrial detainees necessarily must go beyond the use of the *823 word "jail" in the statute and requires a closer look at the statutory structure of which § 129D is part.
We begin by observing that G.L.c. 127 is primarily, if not exclusively, devoted to sentenced prisoners. The chapter is entitled "Officers and Inmates of Penal and Reformatory Institutions. Paroles and Pardons."[5] The reference to "penal and reformatory" institutions clearly suggests that it is convicted prisoners that are at issue; because pretrial detainees are presumed innocent, they are considered not to need punishment or reform. The provisions of G.L.c. 127 cover such various topics as solitary confinement, inmate privileges, parole, and pardons, all of which apply to convicted prisoners. Moreover, § 129D itself is included in that part of G.L.c. 127 entitled "Permits To Be at Liberty and Discharge," which includes not only the various statutes providing for reductions in sentence but also statutes governing parole. This further suggests that § 129D is intended to apply to convicted prisoners.
The general impression discussed above is borne out by the specific language of § 129D. Section 129D describes the programs approved thereunder, as those that are "valuable to [the] prisoner's rehabilitation." As the United States Supreme Court has said, "it would hardly be appropriate for the State to undertake in the pretrial detention period programs to rehabilitate a man still clothed with a presumption of innocence." McGinnis v. Royster, 410 U.S. 263, 273 (1973).[6] This notion of rehabilitation is supported by the *824 statutes that establish the three basic types of programs under which prisoners can earn good conduct credits under § 129D; all of these statutes suggest that the programs are intended for convicted prisoners. First, G.L.c. 127, § 48 (1992 ed.), which provides for the establishment of "education, training and employment programs," does so only for persons committed to the custody of the department of correction or to county "correctional facilities."[7] Neither G.L.c. 124, governing the Department of Correction, nor G.L.c. 125, governing "correctional facilities," evidences any indication that they are meant to apply to pretrial detainees, in contrast to G.L.c. 126, governing jails and houses of correction, which specifically mentions persons held for trial. Second, G.L.c. 127, § 71 (1992 ed.), which governs the handling of funds from prison industries, refers to the participants in such programs as "committed offenders," a category that includes only convicted prisoners.[8] Third, G.L.c. 127, § 86F (1992 ed.), which provides for work release programs, states that sheriffs may establish such programs for "persons sentenced to the house of correction."
In addition, § 129D, unlike several related statutes, indicates that accrual of the credits for which it provides is to occur while the prisoner is serving his or her sentence. Section 129D allows a "deduction of sentence ... for each month while said prisoner is [participating in approved programs]." Because a pretrial detainee has no sentence from which to deduct earned good conduct credits, and because the statute does not provide for an accumulation of the credits, this language indicates that § 129D was intended to apply only to convicted prisoners. This conclusion is strengthened *825 by the contrasting language of related sections governing deductions from sentence, which specifically refer to factors beyond a prisoner's current status. Section 129B, for example, provides that time served is to be deducted from "[t]he sentence of any prisoner in any correctional institution of the commonwealth or in any house of correction or jail, who was held in custody awaiting trial...." The specific reference to prisoners' possible pretrial detention distinguishes § 129B from § 129D, and makes it unreasonable to infer from provision in § 129B for sentence credit for pretrial detention that the same rule should be applied to earned good conduct credits under § 129D. Similar considerations obtain in § 129, which provides for statutory good time, namely good time that requires no affirmative effort on the part of a prisoner but is awarded for a good conduct.[9]
Finally, some guidance as to the legislative intent regarding § 129D is also available from a legislative report that was prepared prior to the statute's adoption and that proposed a statute substantially similar to what is now § 129D. See Final Report of the Special Committee of the Senate Authorized to make an Investigation and Study of the Corrections System of the Commonwealth, 1973 Senate Doc. No. 1504, App. C, at 93-94. The report is dated February 5, 1973, and § 129D was approved on July 10, 1973, see St. *826 1973, c. 528, approximately five months later. In the report's discussion of the desirability of a statute like § 129D, it repeatedly refers to the potential recipients of earned good conduct credits as "offenders," a term which suggests that it is convicted prisoners that are contemplated. 1973 Senate Doc. No. 1504, at 50. Cf. G.L.c. 125, § 1 (c) (1992 ed.) (defining "committed offender" as "a person convicted of a crime and committed, under sentence, to a correctional facility"). For example, the relevant portion of the report concludes that "[t]he committee recommends that the superintendent of the corrections institutions in which the offender resides, be given the authority to award additional good-time deductions for behavior or achievements on the part of the inmate which is [sic] meritorious." 1973 Senate Doc. No. 1504, at 50-51.
For the reasons discussed above, we conclude that § 129D was intended to apply only to sentenced prisoners.
2. The plaintiff argues next that, if G.L.c. 127, § 129D, is interpreted to apply only to convicted prisoners, the statute is violative of the equal protection guarantees of the United States and Massachusetts Constitutions. This issue was not reached by the judge who found for the plaintiff on his statutory interpretation argument. We shall resolve the issue because the record is adequate. We shall also interpret our equal protection guarantee as identical to Federal equal protection guarantee. See Commonwealth v. Arment, 412 Mass. 55, 63 (1992); Commonwealth v. Franklin Fruit Co., 388 Mass. 228, 235 (1983).
We first must decide whether the distinction drawn by § 129D is subject to strict scrutiny or to the more lenient rational-relationship test. The plaintiff argues that the constitutional status of G.L.c. 127, § 129D, should be examined under strict scrutiny. He points, however, to no decision supporting that argument, and exactly the opposite conclusion has been reached by the United States Supreme Court in McGinnis v. Royster, 410 U.S. 263 (1973). The McGinnis decision considered a New York statutory scheme under which prisoners' earliest parole dates were calculated by including *827 credits for good time, but only good time after sentencing. The Court stated that the statutory classifications "require[d] only some rational basis to sustain them." Id. at 270.[10] We see no need to diverge from that analysis, and shall apply a rational relationship test to the problem in this case. See Chestnut v. Magnusson, 942 F.2d 820, 823-824 (1st Cir.1991) (collecting cases and concluding that "[t]he indigency that may lead to an inability to post bail does not suffice to create a class calling for strict scrutiny rather than a rational relationship analysis").[11]
Under the rational relationship test, we "inquire only whether the challenged distinction rationally furthers some legitimate, articulated state purpose." McGinnis v. Royster, supra at 270. See Commonwealth v. Arment, supra at 63. The commissioner states that his interpretation of § 129D, "furthers the legitimate government purpose of rehabilitating convicted criminals and maintaining discipline in the prison setting." He argues that drawing a distinction between pretrial detainees and sentenced prisoners is rational in light of these purposes because only sentenced prisoners need rehabilitation and because the prospect of a possible future sentencing hearing is sufficient to motivate pretrial detainees.
*828 We agree with the commissioner that, distinguishing for the purposes of G.L.c. 127, § 129D, between pretrial detainees and sentenced prisoners is rationally related to the statute's articulated rehabilitative purpose. The Legislature could reasonably believe that the importance of attempting to rehabilitate convicted offenders does not extend, at least not to the same extent, to persons who are being held prior to trial. This has been the conclusion reached by the courts that have considered good time statutes with rehabilitative, rather then disciplinary, purposes. See McGinnis v. Royster, supra; Lemieux v. Kerby, 931 F.2d 1391, 1394 (10th Cir.1991) ("We are satisfied that [the good time statute at issue] serves a rational purpose of rehabilitating criminals ..."); State v. Aqui, 104 N.M. 345, 349 ("[I]t is clear that the distinction our statutes draw between the treatment of presentence detainees and sentenced prisoners reflects an articulated state purpose of rehabilitation and industry, and that that purpose is legitimate and nonillusory"), cert. denied, 479 U.S. 917 (1986).
Furthermore, the plaintiff acknowledges that G.L.c. 127, § 129D, "grants [the commissioner] the authority to determine whether to offer a rehabilitative program." The commissioner has established such programs primarily in State correctional facilities. Any lack of approved rehabilitative programs for pretrial detainees provides an additional basis for distinguishing between pretrial detainees and sentenced prisoners.[12] See McGinnis v. Royster, supra at 271 ("While appellees do point to the existence of some rehabilitative or recreational facilities within some county jails, it is clear that *829 nothing comparable to the State's rehabilitative effort exists" [footnote omitted]); State v. Nyborg, 122 Wis.2d 765, 771 (Ct. App. 1985) ("It is undisputed that our state prisons have educational and work programs and our county jails have few. As in McGinnis, this difference is significant and is a rational basis for distinguishing between persons who serve their entire sentence in prison and those who serve part of their sentence in county jails").
3. Our conclusion that § 129D applies only to sentenced prisoners, and that the statute does not offend equal protection guarantees, makes it unnecessary to consider the issues pertaining to the propriety and scope of the preliminary injunction.
4. The preliminary injunction entered on January 14, 1994, is vacated. The partial final judgment entered in the plaintiff's case on February 11, 1994, is vacated. A new judgment is to enter declaring that the plaintiff, and members of the certified class, are not entitled to credit under G.L.c. 127, § 129D, for participation in any approved programs thereunder, during the period they were held in pretrial confinement.
So ordered.
NOTES
[1]  A class "comprised of all sentenced Massachusetts prisoners who have participated, or are participating, in work, educational or other rehabilitative programs while they were held in jail awaiting trial, and who would have qualified for earned good conduct deductions for such activities had they been serving sentences at the time of such participation" was certified.
[2]  The record does not disclose whether the sheriffs have been actually added to the case as defendants. The sheriffs of four counties, who have filed an amicus brief in support of the commissioner's position, state that the sheriffs are now parties to the case. A joint amicus brief in support of the commissioner's position has also been filed by the Attorney General and the Massachusetts Parole Board.
[3]  General Laws c. 127, § 129D (1992 ed.), reads, in relevant part, as follows:

"For the satisfactory conduct of a prisoner while confined at a correctional institution of the commonwealth, or any jail or house of correction, but [participating in any of a variety of approved work, educational, or counselling programs or activities] which the superintendent of the institution shall deem valuable to said prisoner's rehabilitation, the commissioner may grant, in addition to the deductions of sentence provided under [G.L.c. 127, §§ 129 and 129C], a further deduction of sentence of not more than two and one-half days per program or activity for each month while said prisoner [is participating in the program or activity]; provided, however, that in no event shall said deductions exceed a maximum monthly total of seven and one-half days. Such further deduction of sentence shall be added to any deduction to which the prisoner is entitled under [§§ 129 and 129C] for reducing the term of imprisonment by deduction from the maximum term for which he may be held under his sentence or sentences, and for reducing from the minimum term of the sentence or sentences the good conduct credits earned under this section for parole eligibility as provided under [G. L.c. 127, § 133]."
[4]  The plaintiff also makes the related argument that, when the Legislature added the phrase "or any jail or house of correction" to § 129D, see St. 1981, c. 181, it was presumably aware of a distinction between jails (housing pretrial detainees) and houses of correction (housing convicted prisoners), and that it therefore intended to include pretrial detainees in § 129D. This argument is undercut by the Legislature's addition of the effectively identical phrase "or in any house of correction or jail" to G.L.c. 127, § 129B, see St. 1961, c. 74, in a context in which it is clearly not intended to refer to pretrial detainees. The added phrase in § 129B applies, as it does in § 129D, to the word "prisoner," but that word in § 129B is part of the phrase "[t]he sentence of any prisoner." In that context, it obviously cannot include pretrial detainees. We shall therefore not assume that it does so in § 129D.
[5]  "Chapter headings and captions between sections are part of the General Laws...." Editorial Notes, General Laws of Massachusetts i (1992 ed.).
[6]  The plaintiff points out that Burno v. Commissioner of Correction, 399 Mass. 111 (1987), describes the purpose of § 129D as to "encourage activity that will make incarceration a more personally rewarding experience and improve prisoners' lives outside of prisons." Id. at 120 n. 8. Contrary to the plaintiff's contention, we do not believe that this description is inconsistent with a rehabilitative purpose. Nor does the plaintiff's observation, no doubt true, that education and training activities can be of benefit to pretrial detainees as well as convicted prisoners overcome the impression that "rehabilitation" is likely to be aimed at sentenced prisoners.
[7]  In addition, G.L.c. 127, § 49 (1992 ed.), provides that a prisoner may participate in education, training, and employment programs outside his correctional facility if he "has served such a portion of his sentence or sentences that he would be eligible for parole within eighteen months." The statute thus assumes that the prisoners eligible for these programs have been sentenced.
[8]  A "committed offender" is defined as "a person convicted of a crime and committed, under sentence, to a correctional facility." G.L.c. 125, § 1 (c) (1992 ed.).
[9]  The plaintiff states, and the judge found, that under § 129, the commissioner grants statutory good time not only based on postsentence time but also based on pretrial detention. The plaintiff provides no evidence that this is the case, nor does the commissioner concede that this is true.

If such a policy exists, it would be supportable under the specific language of § 129, not present in § 129D, which provides that with statutory good time a prisoner is "entitled to have the term of his imprisonment reduced by a deduction from the maximum term for which he may be held under his sentence or sentences." The commissioner could base a policy of allowing statutory good time for pretrial detention by treating pretrial detention as part of "the maximum term for which [a prisoner] may be held." Because a convicted prisoner who served time in pretrial custody was indeed "held" for that time, such an interpretation would be reasonable. The interpretation would rely on the definition of "maximum term," however, and it would not suggest that the term "prisoner" in § 129, or in § 129D, includes pretrial detainees.
[10]  The New York statutory scheme did include presentence good time credits in its calculation of the latest date at which a prisoner could be paroled. McGinnis v. Royster, 410 U.S. 263, 267 (1973). In that respect it was unlike the present case, in which no presentence earned good conduct credits are included for any prisoner release dates. However, the McGinnis decision did not suggest that that was a factor in its application of a rational basis test. Instead, it referred to the fact that "the distinction of which appellees complain arose in the course of the State's sensitive and difficult effort to encourage for its prisoners constructive future citizenship while avoiding the danger of releasing them prematurely upon society." Id. at 269-270. Those considerations are equally at stake here.
[11]  We are aware that in both Griess v. State, 624 F. Supp. 450 (D. Colo. 1985), aff'd, 841 F.2d 1042 (10th Cir.1988), and, arguably, People v. Sage, 26 Cal.3d 498 (1980), the courts applied a strict scrutiny standard to failures to award good time credits for pretrial detention. Those courts, however, were considering good time credits more akin to those for "statutory" good time than for the earned good conduct at issue in the present case. We are not persuaded by these decisions that strict scrutiny analysis is required in this context.
[12]  It may be true, as the plaintiff argues (although with only partial support in the record), that "most of the county correctional facilities" have programs approved by the commissioner for credit under § 129D. See 103 Code Mass. Regs. § 411.08 (1990). Even if so, it does not follow that it would be irrational for the commissioner to distinguish between pretrial detainees, who may have access to the rehabilitative programs, and sentenced prisoners. The commissioner could provide such programs to pretrial detainees while still rationally believing that it is necessary to provide the extra encouragement to take advantage of them only to sentenced prisoners.
