delivered the opinion of the court:
Defendant, Jeffrey Morgan, a convicted child sex offender, was convicted following a jury trial of knowingly residing within 500 feet of a school building that persons under the age of 18 attended (720 ILCS 5/11 — 9.3(b—5) (West 2006)). Defendant was sentenced to 30 months’ probation and fined. Defendant appeals his conviction and fines. We affirm in part and vacate and remand in part.
FACTS
Defendant was convicted in 1997 of a sex offense involving a child. In 1998 the Illinois General Assembly prohibited the presence of child sex offenders in school zones. 720 ILCS 5/11 — 9.3 (West 2006). In July 2000 an amendment was added prohibiting child sex offenders from residing within 500 feet of a school that children under the age of 18 attended. 720 ILCS 5/11 — 9.3(b—5) (West 2006). Defendant was released from prison in 1999. In April 2005 defendant was arrested for living within 500 feet of the Longfellow School in Rock Island, Illinois, and charged under section 11 — 9.3(b—5). Defendant was convicted at jury trial in October 2005 and sentenced to 30 months’ probation. He was also fined $1,000 and an additional $40 for the Violent Crime Victims Assistance Fund. Defendant now appeals.
ANALYSIS
On appeal, defendant contends that section 11 — 9.3(b—5) of the *823Illinois Criminal Code of 1961 violates the ex post facto clause of the constitution. He also contends that his $40 fine for the Violent Crime Victims Assistance Fund should be vacated and that he should receive a $40 credit against the larger fine.
Defendant contends that section 11 — 9.3(b—5) violates the ex post facto clause of the both the Illinois and United States Constitutions. Specifically, defendant argues that he is being punished under the statute for a crime that he committed before the statute took effect in July 2000. The State counters that the ex post facto clauses have not been violated because the offense defined in the statute is a new offense for which being a child sex offender is merely one factor and that, further, even if ex post facto analysis is appropriate, the statute does not have a punitive effect so as to violate ex post facto provisions.
The Constitution of the United States provides that no state shall pass any ex post facto law. U.S. Const., art. I, §10. The Illinois Constitution likewise provides that no ex post facto law shall be passed. Ill. Const. 1970, art. I, §16. The general intent and meaning behind the prohibition was expressed early in our constitutional history when United States Supreme Court Justice Samuel Chase defined ex post facto laws thusly:
“Every law that makes an action done before the passing of the law, and which was innocent when done, criminal; and punishes such action. 2nd. Every law that aggravates a crime, or makes it greater than it was, when committed. 3rd. Every law that changes the punishment, and inflicts a greater punishment, than the law annexed to the crime, when committed. 4th. Every law that alters the legal rules of evidence, and receives less, or different, testimony, than the law required at the time of the commission of the offense, in order to convict the offender. All these, and similar laws, are manifestly unjust and oppressive.” (Emphasis omitted.) Calder v. Bull, 3 U.S. (3 Dali.) 386, 390, 1 L. Ed. 648, 650 (1798).
When analyzing a statute’s constitutional validity or invalidity, our supreme court has provided general guidelines that we must follow in People v. Malchow, 193 Ill. 2d 413, 739 N.E.2d 433 (2000). “A statute is presumed constitutional, and the party challenging the statute bears the burden of demonstrating its invalidity.” Malchow, 193 Ill. 2d at 418, 739 N.E.2d at 437. “The court has a duty to construe a statute in a manner that upholds its validity and constitutionality if it can be reasonably done.” Malchow, 193 Ill. 2d at 418, 739 N.E.2d at 437. “Whether a statute is constitutional is a question of law that is reviewed de novo.” Malchow, 193 Ill. 2d at 418, 739 N.E.2d at 437.
The statute at issue in the present case reads as follows:
“It is unlawful for a child sex offender to knowingly reside within *824500 feet of a school building or the real property comprising any school that persons under the age of 18 attend. Nothing in this subsection (b — 5) prohibits a child sex offender from residing within 500 feet of a school building or the real property comprising any school that persons under 18 attend if the property is owned by the child sex offender and was purchased before the effective date of this amendatory Act of the 91st General Assembly.” 720 ILCS 5/11 — 9.3(b—5) (West 2006).
It is not contested that defendant qualified as a child sex offender under the statute and was subject to its provisions. Rather, defendant challenges the constitutionality of the statute as an unconstitutional ex post facto law punishing him for something (the original sex offense) that occurred before the enactment of the statute. We find instructive to our analysis of section 11 — 9.3(b—5) a Fifth District case, People v. Leroy, 357 Ill. App. 3d 530, 828 N.E.2d 769 (2005), which dealt with a nearly identical statute. In Leroy, defendant, a convicted child sex offender, challenged section 11 — 9.4(b—5) of the Illinois Criminal Code, which is a statutory provision nearly identical to the one at issue in the instant case, except that it bans child sex offenders from loitering within 500 feet of a playground facility comprising any public park when children under 18 are present. In the present case, both State and defense briefs have conceded the nearly identical nature of sections 11 — 9.4(b—5) and 11 — 9.3(b—5). Therefore, the analysis employed by the Leroy court will be employed here.
The subsection at issue in Leroy stated:
“It is unlawful for a child sex offender to knowingly reside within 500 feet of a playground or a facility providing programs or services exclusively directed toward persons under 18 years of age. Nothing in this subsection (b — 5) prohibits a child sex offender from residing within 500 feet of a playground or a facility providing programs or services exclusively directed toward persons under 18 years of age if the property is owned by the child sex offender and was purchased before the effective date of this amendatory Act of the 91st General Assembly.” 720 ILCS 5/11 — 9.4(b—5) (West 2002).
The court first looked to determine whether the statute constituted punishment and thus established criminal proceedings. Leroy, 357 Ill. App. 3d at 537, 828 N.E.2d at 779. The court noted:
“When faced with a question of whether a given statute imposes a punishment, a reviewing court must first ascertain whether the legislature meant the statute to establish ‘civil’ proceedings. [Citation.] If the legislature intended to impose a punishment, the inquiry is complete. [Citation.] If, however, the intention of the legislature was to enact a regulatory scheme that is civil and non-punitive, the reviewing court must further examine whether the *825statutory scheme is so punitive in either purpose or effect that it negates the state’s intention to deem it civil. [Citation.] In making this determination, the reviewing court should ordinarily defer to the legislature’s stated intent, and only the clearest proof will suffice to override legislative intent and transform what has been denominated a civil remedy into a criminal penalty.” Leroy, 357 Ill. App. 3d at 538, 828 N.E.2d at 779, citing Smith v. Doe, 538 U.S. 84, 92, 155 L. Ed. 2d 164, 176, 123 S. Ct. 1140, 1146-47 (2003).
•3 The court determined the statute was not punitive but rather intended to protect children from known child sex offenders and thus was a regulatory act of the General Assembly to create a civil, nonpunitive statutory scheme to protect the public rather than impose a punishment. Leroy, 357 Ill. App. 3d at 538, 828 N.E.2d at 779. Once the court concluded that the intent behind the statute was civil and not punitive, it needed to consider whether the effect of the law was so punitive that it negated the state’s attempt to craft civil restrictions. Leroy, 357 Ill. App. 3d at 538, 828 N.E.2d at 779. Whether the punitive effect negates the civil nonpunitive purpose is evaluated using five factors from United States Supreme Court precedent that, while not exhaustive or dispositive, are “ ‘ “useful guideposts” ’ [citation].” Leroy, 357 Ill. App. 3d at 538-39, 828 N.E.2d at 780. The five factors are the following:
“(1) whether the restriction has historically been regarded as punishment, (2) whether the restriction imposes an affirmative disability or restraint, (3) whether the restriction promotes the traditional aims of punishment, namely retribution and deterrence, (4) whether the restriction has a rational connection to a nonpunitive purpose, and (5) whether the restriction is excessive with respect to this purpose.” Leroy, 357 Ill. App. 3d at 538-39, 828 N.E.2d at 780, citing Smith, 538 U.S. at 97, 155 L. Ed. 2d at 180, 123 S. Ct. at 1149.
•4 In examining the first factor, the court noted that defendant compared the restrictions under the statute to the historical punishment of “banishment.” The court rejected that characterization, noting that there was no evidence that the defendant could not return to live in his original community or that he would be unable to assimilate himself into a new community, the traditional aspects of banishment. Leroy, 357 Ill. App. 3d at 539, 828 N.E.2d at 780. The court also noted that just because the defendant was prohibited from “residing” at his mother’s house because it was less than 500 feet from a school, nothing prevented him from visiting his mother there. The court concluded by finding:
“[T]he restrictions placed on the defendant by subsection (b — 5) in no way resemble the historical punishment of banishment, and *826only a tortured reading of the term banishment could lead us to conclude otherwise. On the record before us, we cannot conclude that the restrictions of subsection (b — 5) are a historic form of punishment.” Leroy, 357 Ill. App. 3d at 539-40, 828 N.E.2d at 780-81.
Turning to the second factor, whether the restriction imposed an affirmative disability or restraint, the court found that although the subsection specifically restricted persons from living in certain areas, it did not otherwise restrict the movement and activities of such persons. Leroy, 357 Ill. App. 3d at 540, 828 N.E.2d at 781. Mindful that restricting the freedom of those deemed dangerous has historically been a legitimate nonpunitive governmental objective, the court found that although the disability or restraint imposed by the subsection was not minor or indirect, the court was not convinced that the presence of that factor alone turned the subsection’s purpose from regulatory to punitive. Leroy, 357 Ill. App. 3d at 540, 828 N.E.2d at 781.
The third factor, whether the restriction promoted the traditional aims of punishment (such as retribution and deterrence), was next addressed by the court. The court rejected any notion that the restriction was meant as retribution, instead finding that it bore a reasonable relationship to the stated purpose of keeping children safe from child predators and promoted a reasonable method of accomplishing that goal. Leroy, 357 Ill. App. 3d at 540, 828 N.E.2d at 781. With regard to the deterrence factor, the court did admit that prohibiting child sex offenders from living closer to a school would prevent incidental contact between offenders and children, which could deter more crimes from happening. However, the court stated that even an obvious deterrent purpose did not necessarily make a law punitive, and it relied on United States Supreme Court precedent that to hold that the mere presence of a deterrent purpose renders a statute criminal would severely undermine the government’s ability to engage in effective regulation. Leroy, 357 Ill. App. 3d at 541, 828 N.E.2d at 781, citing Smith, 538 U.S. at 102, 155 L. Ed. 2d at 183, 123 S. Ct. at 1152. The court thus concluded that the subsection’s purpose was protection of the public and that it did not significantly promote either retribution or deterrence. Leroy, 357 Ill. App. 3d at 541, 828 N.E.2d at 781.
The court quickly found that the fourth factor, a rational connection to a nonpunitive purpose, was readily apparent, as the purpose was to protect children from sex offenders, and it would be reasonable to conclude that restricting those offenders from residing within 500 feet of a playground providing programs or services exclusively *827directed at those under 18 might also protect society. Leroy, 357 Ill. App. 3d at 541, 828 N.E.2d at 782.
The fifth and final factor, whether the restriction was excessive to its purpose, was also considered by the court. The court noted that of the 13 states that had enacted some form of residency restriction applicable to sex offenders, the 500-foot restriction was least restrictive in geographic terms. Leroy, 357 Ill. App. 3d at 541, 828 N.E.2d at 782. The United States Supreme Court had already concluded that, in regard to the excessiveness inquiry of an ex post facto analysis, the issue is not whether the legislature made the best choice possible to address the problem it sought to remedy, but rather whether the regulatory means chosen were reasonable in light of the nonpunitive objective. Leroy, 357 Ill. App. 3d at 541, 828 N.E.2d at 782, citing Smith, 538 U.S. at 105, 155 L. Ed. 2d at 185, 123 S. Ct. at 1154. As the subsection simply restricted residency to a degree, and did not otherwise curtail the movement and activities of child sex offenders, the court declined to find it excessive. Leroy, 357 Ill. App. 3d at 541, 828 N.E.2d at 782. The appellate court concluded that, under the Supreme Court factors, the subsection was not so punitive that it negated the state’s attempt to craft civil restrictions, and thus did not constitute an unconstitutional ex post facto law. Leroy, 357 Ill. App. 3d at 541-42, 828 N.E.2d at 782.
Turning to the subsection at issue in the instant case, we adopt the reasoning and analysis employed by the Fifth District in Leroy and apply it to the subsection under consideration before us. In doing so, we find that the law is constitutional. We conclude that, in accordance with the analysis employed by the court in Leroy, section 11 — 9.3(b—5) does not constitute an impermissible ex post facto law. Therefore, defendant’s argument must fail.
Defendant next argues that he should receive a $40 credit against his $1,000 fine based on time credit of eight days for time served. He also argues that, since other fines were imposed, the $40 Violent Crime Victims Assistance Fund fine should be vacated.
By statute in Illinois, a person incarcerated for a bailable offense and against whom a fine is levied is entitled to $5-a-day credit for each day in custody. 725 ILCS 5/110 — 14 (West 2006). Further, regarding the $40 Violent Crime Victims Assistance Fund fine, the statute states that the fine may be collected when someone is convicted and no other fine is imposed. 725 ILCS 240/10(c) (West 2006). However, if other fines have been imposed on an offense, the fine may not be collected. People v. Jones, 375 Ill. App. 3d 289, 297, 873 N.E.2d 562, 569 (2007).
The State concedes both points raised by defendant. As such, we vacate the $40 Violent Crime Victims Assistance Fund fine and order that a $40 credit be applied to defendant’s $1,000 fine for the offense.
*828In conclusion, we affirm defendant’s conviction and find that section 11 — 9.3(b—5) does not violate the ex post facto clauses of the Illinois and United States Constitutions. We also vacate the $40 Violent Crime Victims Assistance Fund fine levied on defendant and direct the trial court to enter an order allowing a $40 credit to be applied against defendant’s $1,000 fine.
Affirmed in part and vacated in part; cause remanded with directions.
LYTTON, EJ., and HOLDRIDGE, J., concur.