We transferred here the defendant’s appeal from the denial of his motion, based on Mass. R. Crim. P. 30 (a), 378 Mass. 900 (1979), that sought an order that would vacate guilty findings against him and terminate his commitment as a sexually dangerous person. We reject the defendant’s arguments that (1) his commitment to the treatment center in Bridgewater was unlawful and (2) his continued *237commitment as a sexually dangerous person violates his State and Federal right to due process and equal protection of the law and subjects him to punishment in violation of the double jeopardy clause of the United States Constitution.1 We, therefore, affirm the order denying the defendant’s rule 30 motion.
In October, 1982, the defendant pleaded guilty to twenty-one crimes arising out of three separate incidents that had occurred earlier that year. Among the crimes charged were aggravated rape, assault with intent to commit rapé, and armed robbery. On the same day, a judge sentenced the defendant on all but one of the twenty-one indictments. The judge continued indefinitely any sentencing on one indictment charging aggravated rape. On the next day, the Commonwealth moved, as to the conviction on which the defendant had not yet been sentenced, that the defendant be committed to the treatment center in Bridgewater as a sexually dangerous person pursuant to G. L. c. 123A, § 4, as appearing in St. 1958, c. 646, § 1. The judge sent the defendant to the treatment center for a sixty-day examination. See G. L. c. 123A, § 4, as appearing in St. 1958, c. 646, § 1. Subsequently, after a hearing, the judge found that the defendant was a sexually dangerous person and committed him to the treatment center for an indeterminate period of from one day to life pursuant to G. L. c. 123A, § 5, as appearing in St. 1958, c. 646, § 1. Under G. L. c. 123 A, § 5, as then amended, such a commitment was authorized in lieu of a prison sentence. The defendant argues that, but for this commitment, he would have been eligible for parole in 1992 and for discharge no later than 2005.
1. There is no merit in the defendant’s argument that, after sentencing him on twenty convictions, the judge lacked authority to use the twenty-first conviction to send the defendant to the treatment center for observation and thereafter to commit him to an indeterminate term. In Commonwealth v. Godfroy, 420 Mass. 561, 564 (1995), citing Commonwealth v. Desroches, 27 Mass. App. Ct. 866, 868 (1989), we held that, under the statute in effect at the time of Godfrey’s guilty pleas (G. L. c. 123A, § 5, as appearing in St. 1985, c. 752, *238§ 1), the judge could not properly sentence a person on the crimes to which he pleaded guilty and thereafter, as to the same crimes, commit him to the treatment center as a sexually dangerous person. That is not the case here. The judge had not yet sentenced the defendant on the conviction that underlay the judge’s determination to send the defendant to the treatment center and then, after a hearing, to commit him as a sexually dangerous person.2 The fact that the judge had already sentenced the defendant on other convictions did not deprive him of authority to commit the defendant to the treatment center in lieu of sentence on the remaining indictment for aggravated rape.
2. The defendant next argues that, because the Legislature has repealed G. L. c. 123A, §§ 3-5 (see St. 1990, c. 150, § 304), eliminating all new commitments to the treatment center, his continued retention in the treatment center violates his constitutional rights.3 He contends that his commitment is penal in nature because it has been demonstrated that the treatment purposes of G. L. c. 123A cannot be realized. The defendant further relies on St. 1993, c. 489, which transferred control of the treatment center from the Department of Mental Health to the Department of Correction. He claims that, because his commitment to the treatment center was imposed without all the due process protections applicable to a criminal proceeding, and because his commitment is now solely penal, he has been denied due process of law. Further, he argues that he has been denied equal protection of the laws because there is no adequate justification for treating *239him differently from others who have committed similar crimes.4
We have held that the commitment statute has a remedial, nonpunitive purpose. See Commonwealth v. Barboza, 387 Mass. 105, 111-112, cert. denied, 459 U.S. 1020 (1982). See also Hill, petitioner, 422 Mass. 147, 152-154, cert. denied, 117 S. Ct. 177 (1996); Sheridan, petitioner, 412 Mass. 599, 604 (1992). The defendant’s due process argument fails because he has not shown that the treatment center lacks continued viability as a place where sexually violent offenders can receive nonpunitive psychiatric treatment. Indeed, as a result of a 1994 discharge hearing sought by the defendant (see G. L. c. 123A, § 9), a Superior Court judge found that the defendant had been involved in treatment at the center, including individual and group therapies, with varying degrees of success.
The defendant argues next that his equal protection rights are violated under the Federal and State Constitutions because there is no constitutionally acceptable basis for creating two classes of prisoners who committed sex crimes, one subject to indefinite terms of detention and the other serving definite sentences with the possibility of parole. The issue is the same under each Constitution. Zeller v. Cantu, 395 Mass. 76, 83-84 (1985). The question is whether there is a rational basis for the classification, a rational relationship between the line drawn and a legitimate State interest. See Commonwealth v. Arment, 412 Mass. 55, 63 (1992). The defendant’s principal argument raises the question whether there is a rational justification for continuing the commitment of the defendant in the treatment center while, because of the repeal of G. L. c. 123A, §§ 3-6 and § 7 (St. 1990, c. 150, § 304), no one else can be committed to the treatment center.
In Commonwealth v. Arment, supra, we held that no public interest justified making a distinction between (a) prisoners serving time for pre-April 6, 1986, offenses for which a superintendent of a correctional facility could institute commit*240ment proceedings “on the mere belief that the prisoner is sexually dangerous” and (b) prisoners serving time for later offenses who could have such proceedings instituted against them only because of a sexual assault committed while under sentence. Id. at 61-63. There was no rational basis for giving a superintendent of a correctional institution different grounds for seeking commitments for sexual dangerousness based solely on when an inmate committed the crime for which he was incarcerated. Significantly, the Arment case did not involve the prospective termination of a program.
In Commonwealth v. Purdy, 408 Mass. 681, 685 (1990), we said that “[t]he. mere fact that some persons were at some later date governed by a law more favorable to them than the law which applied to the defendant is insufficient to strike down an otherwise valid statute; to hold the opposite would be either to eradicate all new statutes or to make them all retroactive.” In Baker v. Superior Court, 35 Cal. 3d 663, 668-670 (1984), the California Supreme Court rejected a substantially similar equal protection argument for the same reason. There, the California Legislature had terminated prospectively a “mentally disordered sex offender” commitment procedure. The plaintiffs, who had been committed under the prospectively abandoned program, claimed impermissible discrimination because persons convicted of a sex offense after the termination of the commitment procedure “are not subject to an indefinite — potentially lifelong — civil commitment and are instead imprisoned for a fixed period of time under the determinate sentence law.” Id. at 668. The court stated that the prospective repeal presented no significant constitutional question. Id. The results following from termination of the program appeared no different, the court said, than is the case when a statutory treatment program is established or eliminated. Id. at 669. “Stripped to its essentials, petitioners’ claim challenges the basic validity of all prospective lawmaking.” Id. at 670.
The defendant less explicitly claims that the prospective termination of commitments to the treatment center estab-. fishes that the premise on which he was sent to the treatment center, that he was a sexually dangerous person, was faulty. He argues that we now know that the distinction then made between persons convicted of sex offenses, classifying only some, such as the defendant, as sexually dangerous persons, *241lacked a proper basis and hence his commitment violated his equal protection rights. Here, as we have just said with regard to the statutory distinction now made between past and future sex offenders, proof is missing that the original basis for his commitment was faulty. There appears to have been a rational basis for the distinction that led to the defendant’s commitment when it was made. A rational justification for keeping the defendant in the treatment center now may be found in the benefits that a person already in the treatment center may receive from continuing treatment. Continued treatment of persons in the treatment center has not been shown to be without value. Indeed, the record shows that the defendant has received beneficial treatment at the center.
The United States Supreme Court’s reasoning in Foucha v. Louisiana, 504 U.S. 71 (1992), does not aid the defendant. In that case, Foucha, who had been found not guilty by reason of insanity, was being unlawfully held in continued confinement in a psychiatric hospital even though he was no longer suffering from the mental illness that had led to his confinement. The defendant in the case before us, unlike Foucha, was convicted of a crime, a crime that underlies his continued confinement at the treatment center. Moreover, the defendant has not been found to be no longer sexually dangerous.
We, therefore, reject the defendant’s equal protection arguments. Equal protection principles do not bar the continuation of the treatment program for persons already in it just because the Legislature terminated future commitments.
The order denying the defendant’s motion under rule 30 is affirmed.
So ordered.
The defendant’s claim that his guilty plea was involuntary is not properly before us because it was not raised in the motion on which the motion judge acted and he did not consider it.
The statute in the Godfroy case is different from the form of G. L. c. 123A, § 5, that applies in the case before us. The version of § 5 applicable in the Godfroy case allowed both the imposition of a sentence and commitment to the treatment center with respect to the same conviction. The problem in the Godfroy case was that the judge failed to make the sexual dangerousness determination before sentencing the defendant.
The Legislature specifically provided that, as recommended in the Report of the Governor’s Special Advisory Panel on Forensic Mental Health (1989) that led to the 1990 act, persons committed to the treatment center prior to the repeal of G. L. c. 123A, §§ 3-6 and § 7 (see St. 1990, c. 150, § 304) “shall be maintained at said treatment center.” St. 1990, c. 150, § 104.
We reject the defendant’s double jeopardy claim that he has been twice punished for the same crime. He has failed to show that his commitment to the treatment center is penal. See Hill, petitioner, 422 Mass. 147, 154, cert. denied, 117 S. Ct. 177 (1996). Moreover, only the commitment to the treatment center (and no prison sentence) was imposed on the conviction that underlay that commitment.