
222 N.J. Super. 241 (1988)
536 A.2d 766
STATE OF NEW JERSEY, PLAINTIFF-RESPONDENT,
v.
LAWRENCE LAWLOR, DEFENDANT-APPELLANT.
Superior Court of New Jersey, Appellate Division.
Argued November 12, 1987.
Decided January 14, 1988.
*243 Before Judges BRODY, LONG and SCALERA.
Mordecai Garelick, Assistant Deputy Public Defender, argued the cause for appellant (Alfred A. Slocum, Public Defender, attorney; Mordecai Garelick, of counsel and on the letter brief).
Cathleen Russo Delanoy, Deputy Attorney General, argued the cause for respondent (W. Cary Edwards, Attorney General of New Jersey, attorney; Cathleen Russo Delanoy, of counsel and on the letter brief).
The opinion of the court was delivered by BRODY, J.A.D.
We are again called upon to interpret the meaning of N.J.S.A. 2C:44-5b(2) (the statute) because of the need for clarification that we noted in State v. Alevras, 213 N.J. Super. 331, 339, n. 2 (App.Div. 1986). The statute entitles a defendant being sentenced to imprisonment to credit for time served under an unrelated previous custodial sentence where the previous sentence was imposed after he had committed the crime for which he is currently being sentenced.
Pursuant to a plea agreement, defendant was sentenced to concurrent terms of imprisonment aggregating five years for 11 thefts and attempted thefts by deception. N.J.S.A. 2C:20-4. Defendant committed the crimes when he passed and attempted to pass bad checks. Pursuant to the plea agreement, the trial judge dismissed several unrelated municipal court complaints and ordered that the terms being imposed for the check offenses be served concurrently but not coterminously with a *244 previous six-month term of imprisonment for shoplifting that had been imposed in another county.[1] The judge gave defendant two days credit for the jail time attributable solely to the check offenses but expressly denied him credit for the five months that he had served by then of the previous six-month term. All of the bad check thefts had been committed prior to imposition of the six-month term for shoplifting. Defendant contends that when he was sentenced for the bad check crimes, he should have been given credit under the statute for the five months that he had served for the shoplifting.
N.J.S.A. 2C:44-5b(2) provides in relevant part:
When a defendant who has previously been sentenced to imprisonment is subsequently sentenced to another term for an offense committed prior to the former sentence, other than an offense committed while in custody;
* * * * * * * *
(2) Whether the court determines that the terms shall run concurrently or consecutively, the defendant shall be credited with time served in imprisonment on the prior sentence in determining the permissible aggregate length of the term or terms remaining to be served; ...
N.J.S.A. 2C:44-5e provides:
(1) When terms of imprisonment run concurrently, the shorter terms merge in and are satisfied by discharge of the longest term.
(2) When terms of imprisonment run consecutively, the terms are added to arrive at an aggregate term to be served equal to the sum of all terms.
These statutes require a judge sentencing a defendant to imprisonment to do the following: (1) determine whether the defendant had previously been sentenced to imprisonment for any other offenses; if so, (2) determine whether the defendant had committed any offense for which he is being sentenced, prior to imposition of the previous custodial sentence or sentences; if so, (3) state whether the term of imprisonment being *245 imposed for that offense is to run concurrently with or consecutively to the previous term, and in either case (4) aggregate the present term with the previous term, (5) credit the defendant with post-sentence time served under the previous term, and (6) credit the defendant with any pre-sentence time served that is solely attributable to the offense for which he is being sentenced as required by R. 3:21-8. See State v. Allen, 155 N.J. Super. 582, 584 (App.Div. 1978), certif. den. 77 N.J. 472 (1978); State v. Council, 137 N.J. Super. 306, 308 (App.Div. 1975); State v. Lynk, 166 N.J. Super. 400, 403 (Law Div. 1979).
The effect of taking these steps when imposing a term of imprisonment is to prevent a defendant who receives concurrent sentences of imprisonment that could have been imposed at the same time from having to serve more time solely because they were imposed at different times. It should be noted that service of previously imposed terms and currently imposed terms need not overlap to entitle a defendant to this credit.
The judge imposing the current term controls whether the time served under the previous term will be credited against the time to be served under the current term. He does so by stating whether the terms are to be served concurrently or consecutively. If the judge imposes the current term concurrently with the previous term, the time served under the previous term will also be credited against the current term. If the judge imposes the current term consecutively to the previous term, the time served under the previous term will not be credited against the current term.
Applying the sentencing steps here, we note that the judge imposed a five-year aggregate term of imprisonment to run concurrently with the previously imposed six-month term. Aggregating the previous and current sentences requires merging the six-month term into the five-year term, N.J.S.A. 2C:44-5e(1), leaving an aggregate term of five years. Because defendant must "be credited with time served in imprisonment on the prior sentence in determining the permissible aggregate *246 length of the term or terms remaining to be served," N.J.S.A. 2C:44-5b(2), defendant must receive a credit against the five year aggregate term for the five months that he had served under the previous six-month term. If the trial judge did not want defendant to receive credit for time served under the previous sentence, he should have had his sentence run consecutively to that sentence. In that event, aggregating the previous and current sentences requires adding the five-year term to the six-month term, N.J.S.A. 2C:44-5e(2), leaving an aggregate term of five years and six months to which the five-month credit would be applied.
It appears to us from the record that the trial judge understood the plea agreement to mean that he could deny defendant credit for the five months that he had served for shoplifting but that the remaining month of that term had to be served concurrently with the term being imposed for the bad check offenses. That is not a lawful sentence under the Code. Therefore we must remand to the trial judge to afford him an opportunity either to impose the terms concurrently, giving defendant credit for five months against the five-year term being imposed, or to reject the plea agreement. If the judge should reject the agreement, defendant will then have the following options: (1) renegotiate the plea agreement to permit the new terms to run consecutively to the prior six-month term or (2) withdraw his guilty pleas subject to reinstatement of the dismissed municipal court complaints. See State v. Kovack, 91 N.J. 476, 485-486 (1982).
As we noted in Alevras, the reason for uncertainty in interpreting the statute is State v. Richardson, 208 N.J. Super. 399, 408-415 (App.Div. 1986), certif. den. 105 N.J. 552 (1986). There the statute was construed to amend N.J.S.A. 30:4-123.10 in order to compel the Parole Board to aggregate sentences of imprisonment imposed at different times when computing a prisoner's credits for good behavior under N.J.S.A. 30:4-140. The problem as perceived in that case was expressly corrected *247 by adoption of N.J.S.A. 30:4-123.51h, a part of the Parole Act of 1979, which repealed N.J.S.A. 30:4-123.10. To the extent that our opinion differs from Richardson, we respectfully disagree with that opinion.
Defendant also contends that his sentence is excessive. In view of his extraordinarily long record and the paucity of mitigating factors, the point lacks merit even if the terms currently imposed are made consecutive to the prior six-month term. State v. Roth, 95 N.J. 334, 364-365 (1984).
The matter is remanded for further proceedings consistent with the views expressed in this opinion.
NOTES
[1]  The trial judge explained the word "coterminus" to defendant at the time the plea was entered as follows:

The five years [maximum for the crimes to which you are pleading guilty] would be concurrent with the sentence that you have been sentenced to ... in Hudson County, that is, that they be served at the same time but they wouldn't necessarily end at the same time.
