
264 S.W.3d 689 (2008)
Carlos MIKEL, Appellant,
v.
Jill McGUIRE, Superintendent of Tipton Correctional Center and Jean Crane, Records Officer, Respondents.
No. WD 69475.
Missouri Court of Appeals, Western District.
September 30, 2008.
*690 Carlos Mikel, Tipton, appellant acting pro se.
John D. Hoelzer, Jefferson City, for respondents.
Before: THOMAS H. NEWTON, C.J., LISA WHITE HARDWICK, and ALOK AHUJA, JJ.
THOMAS H. NEWTON, Chief Judge.
Carlos Mikel filed a declaratory judgment action against the Department of Corrections (DOC) seeking jail-time credit for his incarceration in St. Louis City (the City) while awaiting the disposition of his St. Louis County (the County) charge. The DOC filed for summary judgment, which the trial court granted. Because the current law does not require a detainer to show the subsequent offense is related to the time in custody, we reverse and remand.

Factual and Procedural Background
On July 9, 2004, the St. Louis City Metropolitan Police Department arrested Mr. Mikel for aggravated stalking and associated offenses. Mr. Mikel pled guilty to these offenses in the City on November 19, 2004, and was sentenced to concurrent terms amounting to four years of imprisonment. One hundred and thirty-seven days were credited to Mr. Mikel's sentence on the City offenses for time spent in jail from July 9, 2004, his date of arrest, to November 23, 2004, his date of delivery to the DOC. In December 2004, the County filed a detainer against Mr. Mikel for first-degree robbery and third-degree domestic assault. Mr. Mikel was transferred to the County jail to await the disposition of the charges during three different periods in 2005. He subsequently pled guilty to second-degree robbery and third-degree domestic assault on October 7, 2005, for stealing the victim's car on June 15, 2004. The County court sentenced Mr. Mikel to concurrent terms amounting to five years, *691 to run concurrently with the City convictions.
Mr. Mikel petitioned the DOC for fifteen months of jail-time credit for the second-degree robbery conviction. The DOC denied his request but credited fifty-three days of jail-time to his sentence. Subsequently, Mr. Mikel filed a pro se motion to amend his sentence with the County court. The court conceded that it was without authority to grant credit and denied Mr. Mikel's motion. Mr. Mikel then filed a declaratory judgment action in the Moniteau Circuit Court against the DOC, seeking fifteen months of jail-time credit. The DOC moved for summary judgment, which the circuit court granted. The circuit court determined that Mr. Mikel was not entitled to jail-time credit for his robbery offense because he was in the custody of the City for aggravated stalking and the County did not issue a detainer against Mr. Mikel during this confinement. Mr. Mikel appeals.

Standard of Review
An appeal from summary judgment is reviewed de novo. Davison v. Mo. Dep't of Corr., 141 S.W.3d 506, 508 (Mo. App. W.D.2004). We will uphold summary judgment if there is no genuine dispute of material fact and the movant is entitled to judgment as a matter of law. Id. We view the record in the light most favorable to the adverse party and give that party all favorable inferences from the record. Id. at 508-09.

Legal Analysis
In his first point, Mr. Mikel argues that the trial court erred in sustaining the DOC's motion for summary judgment because the facts entitled him to judgment as a matter of law. Mr. Mikel claims that he was entitled to jail-time credit of fifteen months against his five-year sentence received in the County for second-degree robbery because his incarceration from July 9, 2004, to October 7, 2005 (the date of his guilty plea), was related to that offense. He alternatively claims that he is entitled to jail-time credit for his incarceration from July 9, 2004, to November 23, 2004 (the date of his delivery to the DOC to begin serving his St. Louis City sentences). The DOC claims that Mr. Mikel is not entitled to any jail-time credit during his fifteen months of incarceration before serving his sentence on the robbery offense because his incarceration was only related to the aggravated stalking offense absent a detainer from the County before November 23, 2004. The DOC is incorrect, and the circuit court erroneously interpreted the law when it granted summary judgment based on the lack of a detainer.
Section 558.031.1[1] states that a person is entitled to "credit toward the service of a sentence of imprisonment for all time in prison, jail or custody after the offense occurred and before the commencement of the sentence, when the time in custody was related to that offense." Under the previous version of section 558.031,[2] the lack of a detainer presumably would justify granting summary judgment to the DOC because the statute explicitly required a detainer concerning the offense when "the person was [already] confined awaiting trial for some unrelated bailable offense." See State ex rel. Lightfoot v. *692 Schriro, 927 S.W.2d 467, 470, 471 n. 4 (Mo.App. W.D.1996). However, the current version of section 558.031 does not include language requiring a detainer or an arrest warrant before the time in custody "relate[s] to" the offense for which credit is sought. The legislature's amendment of a statute is not a useless act, but one that is designed to effect some change in the law, including judicial opinions. State v. Bouse, 150 S.W.3d 326, 334 (Mo. App. W.D.2004). The legislature purposefully omitted the detainer requirement when a person is confined for a bailable offense but is also awaiting disposition of another unrelated offense. Thus, we decline to construe the statute to require a detainer under these circumstances because to do so would render the amendment ineffective.
Moreover, the Missouri Supreme Court has interpreted "related to" as a "very broad term" that is not restricted to "caused by" or "the result of" such that a person's "custody can be `related to' two offenses and the statutory credit will nevertheless apply." See Goings v. Mo. Dep't of Corr., 6 S.W.3d 906, 908 (Mo. banc 1999). Cases subsequent to Goings suggest that incarceration is related to the subsequent offense where the person is eligible for release on bail on the prior offense, but the subsequent charge prevents the person's release from custody. See Wallingford v. Mo. Dep't of Corr., 216 S.W.3d 695, 697 (Mo.App. W.D.2007) (citing State ex rel. Nixon v. Kelly, 58 S.W.3d 513, 519 (Mo. banc 2001)) (applying Goings). A detainer or an arrest warrant concerning the subsequent offense is not needed to prove that the time in custody was related to that offense. Rather, the person has to prove that the subsequent offense would have prevented his release from custody on the prior offense. See Kelly, 58 S.W.3d at 519. In this case, summary judgment was only proper if there was no factual dispute as to whether the second-degree robbery charge would have prevented Mr. Mikel from being released assuming he posted bond on the City charges.
Mr. Mikel argues that joint actions between the City and the County detained him so that his incarceration from July 9, 2004, to November 23, 2004, was related to the robbery offense. In his petition, Mr. Mikel alleged that the City initially arrested him and held him for the County because the Maryland Heights Police Department of St. Louis County had a fugitive warrant against him for first-degree robbery. And the City subsequently discovered that it had charges against him and held him to answer for those charges. He also claims that the County police visited him while he was incarcerated in St. Louis City. To support his allegations, Mr. Mikel attached the arrest report of the City police, dated July 9, 2004, stating that Mr. Mikel had previously stolen the victim's car while in St. Louis County, and showing that Maryland Heights listed him as a fugitive for first-degree robbery. He also attached an undated evidence receipt of the County police indicating that he gave a written statement after a detective interviewed him. The evidence receipt also stated, "HOLD UNTIL CASE CLOSED."
The DOC denied that Mr. Mikel was initially arrested for robbery and stated that his incarceration was solely for the City's aggravated stalking charge. In support, the DOC attached a letter dated June 2007, from the City's police department stating that on June 16, 200[4],[3] a detective entered Mr. Mikel into the REJIS[4] law *693 enforcement database for committing aggravated stalking, and that the City police arrested Mr. Mikel only after a computer check displayed that charge. Additionally, the DOC offered an arrest warrant and a detainer from the Countydated October 28, 2004, and December 16, 2004, respectivelyto show formal action was not taken against Mr. Mikel for the robbery offense until after July 9, 2004.
While the statement within the letter was inconsistent with Mr. Mikel's claim, it did not conclusively show that the robbery offense was not related to Mr. Mikel's confinement, since under Goings, Mikel's confinement could "relate to" two separate offenses. Further, additional statements within the letter actually support Mr. Mikel's claim that his arrest and subsequent confinement were related to the robbery offense. In that letter, the sergeant informed the DOC that a detainer against Mr. Mikel was unnecessary because Mr. Mikel was located inside the St. Louis area. The sergeant also informed the DOC that Mr. Mikel would have been held for any agency that had outstanding charges against him if he would have posted bond for the aggravated stalking. And the arrest report shows that a police department in the County listed him as a fugitive for first-degree robbery on June 15, 2004. Granting Mr. Mikel all reasonable inferences, the evidence could support a finding that, had he posted bond for aggravated stalking, he would have been held in jail for robbery, which would show that the robbery offense was related to his confinement from July 9, 2004, to November 23, 2004. As this issue was in dispute, the circuit court erred in deciding it against him. Mr. Mikel's first point is granted in part.[5]
In his second point, Mr. Mikel challenges the constitutionality of section 558.031.1, arguing that the section is ambiguous, void for vagueness, and violates the Federal Equal Protection and Due Process Clauses because the section is applied discriminatorily. Constitutional challenges must be raised at the earliest possible opportunity. Wallingford, 216 S.W.3d at 697. Mr. Mikel did not raise this challenge in the court below. Instead, Mr. Mikel argued in his petition that the DOC was intentionally misinterpreting Goings, "thereby rendering the statute unconstitutional." Because Mr. Mikel failed to raise the constitutional challenge at the earliest opportunity, we will not review it. Mr. Mikel's second point is denied.

Conclusion
The circuit court erred in granting summary judgment. Therefore, we reverse the judgment of the circuit court and remand for further proceedings.
LISA WHITE HARDWICK and ALOK AHUJA, JJ. concur.
NOTES
[1]  All statutory references are to RSMo 2000 and the Cumulative Supplement 2006 unless otherwise indicated.
[2]  RSMo 1994 section 558.031.1 stated in relevant part:

Time spent in jail or prison awaiting trial for an offense because of a detainer for such offense shall be credited toward service of a sentence of imprisonment for that offense even though the person was confined awaiting trial for some unrelated bailable offense[.]
[3]  The letter reported that the charge was entered into the computer on June 16, 2006, which is an erroneous year because the arrest occurred in 2004.
[4]  "REJIS is a regional data processing center serving governmental agencies in the greater St. Louis, Missouri, area. The acronym stands for REgional Justice Information Service. REJIS is a joint commission of the City and the County of St. Louis." http://www. rejis.org/SERVICE/about.cfm; see also State ex rel. Reg'l Justice Info. Serv. Comm'n v. Saitz, 798 S.W.2d 705, 706 -707 (Mo. banc 1990).
[5]  Mr. Mikel started serving his sentence for aggravated stalking on November 23, 2004: thus, he was not entitled to any days of credit thereafter because he would have been in prison anyway had he not been awaiting the disposition of his robbery offense. See State ex rel. Nixon v. Kelly, 58 S.W.3d 513, 519 (Mo. banc 2001).
