delivered the opinion of the court:
Respondent Donald Krug and petitioner Ruth Elizabeth Krug-Etheridge were divorced in 1972. A settlement agreement was incorporated in the decree. The agreement provided that it was “binding and conclusive” on the parties and that Donald would continue to provide medical and hospitalization insurance for Ruth. Ruth remarried, and Donald brought a petition for modification of his obligation to maintain Ruth’s insurance coverage pursuant to section 510(b) of the Illinois Marriage and Dissolution of Marriage Act (IMDMA) (Ill. Rev. Stat. 1979, ch. 40, par. 510). The trial court held that that statute, as recently amended, was unconstitutional as applied to Donald. Ruth appeals, contending that the trial court erred in its holding on the constitutionality of the statute, and that section 510(b), as amended, is the controlling law in this case.
On November 21, 1972, Ruth Krug-Etheridge obtained a decree of divorce from Donald Krug. The settlement agreement of the parties was incorporated into the decree, and the pertinent portions of that agreement provide that:
“1. *** this settlement agreement shall be binding and conclusive on the parties from the date of the entry of the decree of divorce and thereafter *** 13. *** Donald shall maintain coverage for Ruth on his medical and hospitalization insurance, or in the alternative will provide separate equivalent coverage for Ruth.”
Ruth Krug-Etheridge was remarried between the time of the divorce and the time that the petition which is the subject of this case was filed. Donald’s petition was based on the contention that Ruth’s remarriage terminated his obligation to continue payments of maintenance under section 510(b) of the IMDMA. A hearing was held on the petition on September 18, 1981. At the time of the hearing, section 510(b) provided that “[t]he obligation to pay future maintenance is terminated upon *** the remarriage of the party receiving maintenance ***.” That paragraph was amended by Public Act 82 — 194 to provide that “[ujnless otherwise agreed by the parties in a written separation agreement set forth in the judgment or otherwise approved by the court, the obligation to pay future maintenance is terminated upon *** the remarriage of the party receiving maintenance ***.” Public Act 82 — 194 was signed into law on August 14, 1981, and became effective on January 1,1982.
At the hearing on Donald’s petition, the trial judge stated that he regarded the payments for insurance coverage as maintenance, and that under the provisions of the amended section 510(b) he would have no choice but to order that the payments continue despite Ruth’s remarriage because he was “bound by the agreement.” He also commented that he felt it would be “appropriate to terminate the insurance coverage in view of her remarriage,” but that he would “have to rule in accordance with the statute that has just taken effect.” The judge then stated that “I agree with the outcome that justice and equity lies with the petitioner here [Donald], so I hold that to the extent that the law precludes us from what we should have done in justice and equity, I hold it in violation of the constitutionality of the petitioner. So I hold it unconstitutional to that extent.”
The court then entered an order which terminated Donald’s obligation to pay for Ruth’s insurance. The order stated that “the recent amendment to Ill. Rev. Stat. ch. 40, sec. 510(b), providing for the continuation of maintenance after the remarriage of the recipient, where the original decree provided for medical and hospitalization insurance without termination and where the terms of the decree were ‘binding and conclusive upon the parties from the date of the entry of said decree for divorce and thereafter,’ is unconstitutional.” Ruth appeals from that order.
Ruth’s first contention on appeal is that the trial court erred in holding that Public Act 82 — 194 is unconstitutional “to the extent that the law precludes us from doing what we should have done in justice and equity.” We agree.
In First Federal Savings & Loan Association v. Walker (1982), 91 Ill. 2d 218, the trial court held that the statutory provision which allows a mortgagor to exercise the right to redeem a delinquent mortgage only once in a five-year period was an unconstitutional infringement on the equitable powers of the courts to allow redemption more than once during the period. Our supreme court reversed. The court quoted from Stone v. Gardner (1858), 20 Ill. 304, 309:
“We do not know of any power existing in a court of equity to dispense with the plain requirements of a statute; it has been always disclaimed, and the real or supposed hardship of no case can justify a court in so doing. When a statute has prescribed a plain rule, free from doubt and ambiguity, it is as well usurpation in a court of equity as in a court of law, to adjudge against it; and for a court of equity to relieve against its provisions, is the same as to repeal it.” 91 Ill. 2d 218, 227.
In the instant case, the trial court gave no reason for its ruling on the constitutionality of Public Act 82 — 194 other than its expressed belief that the operation of that statute would prevent it from ruling in accordance with the equities of the case. We hold that the trial court erred in declaring that Public Act 82 — 194 is unconstitutional as applied to Donald.
Ruth next contends that section 510(b) as amended by Public Act 82 — 194 is the law which properly governs this case. The trial court concluded that the amendment to section 510(b) was applicable to Donald’s petition although the hearing on the petition was held on September 18, 1981, and the effective date of the amendment was January 1, 1982. In In re Marriage of Mass (1981), 102 Ill. App. 3d 984, 431 N.E.2d 1, the court held that the amendment of section 510(b) by Public Act 82 — 194 was intended by the legislature to clarify the original legislative intent of that paragraph that existed when the IMDMA was enacted in 1977 (102 Ill. App. 3d 984, 1002), and that therefore the provisions of section 510(b) as amended are fully applicable to proceedings conducted prior to the effective date of the amendment.
Additionally, the amended section 510(b) is the applicable law on the appeal of this case because of the general rule that when the legislature changes the law while an appeal is pending, the reviewing court will apply the law as it exists at the time of its decision, rather than the law as it was at the time of the trial court’s judgment. (See Rios v. Jones (1976), 63 Ill. 2d 488, 494-95, 348 N.E.2d 825, appeal dismissed (1976), 429 U.S. 934, 50 L. Ed. 2d 304, 97 S. Ct. 346; Phillips Petroleum Co. v. City of Park Ridge (1958), 16 Ill. App. 2d 555, 565, 149 N.E.2d 344.) We hold that the amended section 510(b) is fully applicable to this appeal.
The only other question involved in this appeal is whether the recitation in the settlement agreement that the agreement is “binding and conclusive” on the parties obligates Donald, through the operation of section 510(b), to continue to maintain medical and hospitalization insurance for Ruth despite her remarriage. The trial court expressly found that the agreement imposed such an obligation, and Ruth’s brief in this appeal assumes that this obligation exists, while Donald contends that the pertinent language is mere “boilerplate” and that the agreement may be modified to terminate his obligation to maintain the coverage.
In Mass, as in the instant case, the court was faced with the question of whether a settlement agreement which was entered into prior to the enactment of the IMDMA created an obligation for the continued payment of maintenance after the remarriage of the recipient under section 510(b). In Mass, the agreement provided for periodic payments in fixed amounts to extend for a period of over 20 years. The court noted that although the agreement did not expressly preclude modification of the agreement after the remarriage of the recipient, section 502(f) of the IMDMA requires that an agreement to continue payments of maintenance after the remarriage of the recipient be clearly expressed in the agreement. The court held that because the agreement was entered into prior to the effective date of the IM-DMA, the parties were not required to draft the agreement in accordance with the IMDMA’s strict requirements. (102 Ill. App. 3d 984, 1002-03.) The court held that under these circumstances the agreement to continue the payments could properly be implied from the facts and circumstances that existed at the time the agreement was entered into. 102 Ill. App. 3d 984, 1003.
In the instant case, as in Mass, section 502(f)’s requirement that any agreement that would preclude modification of maintenance payments be expressed in the settlement agreement should be relaxed because the agreement was entered into prior to the effective date of the IMDMA. Therefore an inquiry into the intent of the parties when the agreement was entered into is necessary to determine whether such an agreement may be implied. The reviewing court in Mass was presented with the record of a full evidentiary hearing to aid it in deciding whether there was an implied agreement to continue the payments.
In the instant case, the trial court held a brief hearing and made an abrupt sua sponte determination that Public Act 82 — 194 was unconstitutional. The parties were precluded by that ruling from offering any evidence or making any argument going to the intent of the parties and the meaning that they accorded the language that stated that the agreement was “binding and conclusive.” In cases where the trial court on its own motion formulates a theory of the case that becomes the basis for its judgment, the parties must be given the opportunity to present evidence going to that theory. (See Trzebiatowski v. Jerome (1960), 19 Ill. 2d 30, 36, 166 N.E.2d 65.) In the instant case an analogous situation exists. Here, the trial court’s formulation of an unexpected theory of the case prevented the parties from introducing evidence on the only theory under which the case could properly be decided. We therefore find it appropriate to remand this case to the trial court with directions to conduct evidentiary hearings to determine whether the parties intended at the time the agreement was entered into that the recital that the agreement was “binding and conclusive” would bar subsequent modification of the agreement.
Donald asserts that the language of the agreement itself precludes a finding that there was ever an agreement to continue the insurance payments beyond the time that Ruth remarried. He relies on In re Marriage of Pearson (1981), 101 Ill. App. 3d 422, 428 N.E.2d 578, to support his contention that the pertinent language of the agreement was mere “boilerplate” which cannot be construed as limiting the right to modification of the agreement. In Pearson, the preamble to the settlement agreement recited that the agreement was intended to settle questions of child support and maintenance between the parties “now and forever.” The court held that the language in question was merely precatory and not determinative of the rights of the parties primarily because the statement was set forth in the preamble to the agreement rather than in an operative provision. (101 Ill. App. 3d 422, 425.) In the instant case, the relevant language is contained in the body, not the preamble, of the agreement, and therefore cannot be so easily characterized as mere “boilerplate.” Pearson is also distinguishable because the settlement agreement in that case was entered into after the effective date of the IMDMA and was examined in light of the requirements of section 502(f), which preclude a finding of an implied agreement of nonmodifiability. Pearson is therefore inapposite to this case.
For the reasons expressed herein, the judgment of the circuit court of Cook County is reversed and this cause remanded with directions to proceed in conformity with the views expressed herein.
Reversed and remanded with directions.
DOWNING and PERLIN, JJ., concur.