
586 N.E.2d 1211 (1992)
146 Ill.2d 263
166 Ill.Dec. 882
LOYOLA ACADEMY, Appellant,
v.
S & S ROOF MAINTENANCE, INC., et al., Appellees.
No. 70601.
Supreme Court of Illinois.
January 23, 1992.
*1212 Galliani and Doell, Ltd., Chicago (William R. Galliani and Patrick F. Healy, of counsel), for appellant.
Raymond A. Boldt, Mundelein, for appellee S & S Roof Maintenance, Inc.
Peterson, Ross, Schloerb & Seidel, Chicago (Terry M. Cosgrove and Stephen M. Hoke, of counsel), for appellee Kelly Energy Systems, Inc.
Justice CUNNINGHAM delivered the opinion of the court:
Plaintiff, Loyola Academy, appeals from a modified opinion on a denial of a rehearing from the appellate court affirming, with one justice dissenting, the order of the circuit court. (198 Ill.App.3d 799, 144 Ill. Dec. 908, 556 N.E.2d 586.) The circuit court had denied plaintiff leave to amend its complaint after it granted the separate motions of the defendants, S & S Roof Maintenance, Inc. (S & S), and Kelly Energy Systems, Inc. (Kelly), for summary judgment on two of the three counts of plaintiff's complaint. We granted the petition for leave to appeal pursuant to Supreme Court Rule 315(a) (134 Ill.2d R. 315(a)). The only issue before this court is whether the trial court abused its discretion when it denied plaintiff leave to amend its complaint. We reverse the judgments of the appellate and circuit courts and remand this cause to allow plaintiff to amend its complaint. The facts are as follows.
1985. On May 5, 1985, plaintiff filed a three-count complaint against defendants, S & S and Kelly. Counts I and II alleged negligence and breach of warranty, respectively, against S & S. Count III alleged breach of express warranty against Kelly. Each defendant filed answers to the complaint denying specifically any liability.
1986. Kelly filed a motion for summary judgment regarding count III on July 1, 1986, and S & S filed its motion for summary judgment regarding count II only on August 21, 1986. Prior to S & S's filing its motion for summary judgment, the circuit court granted it leave to file instanter its second affirmative defense. The first hearing on Kelly's motion for summary judgment was set for August 29, 1986; however, on August 28, the circuit court ordered:
"that such motion is entered, and plaintiff is granted 28 days, until September 25, 1986 to file its response. It is further ordered that defendant Kelly by [sic] granted 14 days thereafter, until October 9, 1986 to respond and hearing on the motion is continued to November 17, 1986 * * *."
On October 22, 1986, plaintiff filed its response to S & S's motion. On November 5, 1986, the circuit court entered an order granting S & S leave to file its response to plaintiff's answer to its motion for summary judgment. On the following date plaintiff filed its response to Kelly's motion. Eventually, each defendant filed a response.
After the November 17, 1986, hearing, the circuit court entered an order which stated in part:
"1) Co-defendant S & S Roof Maintenance, Inc.'s motion for summary judgment on Count II is granted.
2) Co-defendant Kelly Energy Systems' motion for summary judgment on Count III is granted."
The order did not state whether it was final and appealable.
On December 4, 1986, S & S filed a motion for leave to file a third-party complaint against Kelly and sent notice to the attorneys of record that it would make the motion before the circuit court on February 20, 1987. However, on December 17, 1986, plaintiff filed its motion to reconsider the court's order granting both S & S's and *1213 Kelly's motions for summary judgment on counts II and III.
1987. Approximately 17 months after the lawsuit was initiated, and two months after the circuit court granted defendants summary judgment on two of the three counts, plaintiff sent notice to the attorneys of record that it would move for leave to file instanter its first amended complaint on February 20, 1987. At the February 20 hearing, the circuit court continued the matter to March 9, 1987, with the agreement of the parties, in order to dispose of the motion for leave to amend in conjunction with S & S's motion for leave to file a third-party complaint against Kelly and plaintiff's motion to reconsider the November 17, 1986, order because the latter motions were already set for that date. We note that the notice regarding the motion for leave to file instanter an amended complaint was not found in the main court record but within the exhibits attached to Kelly's response as third party to plaintiff's motion for leave to file an amended complaint.
At the March 9, 1987, hearing, the circuit court denied plaintiff's motion to reconsider the order of November 17, 1986, and granted defendant S & S's motion for leave to file its third-party complaint against defendant Kelly. The attorneys and the circuit court did not address plaintiff's motion for leave to file an amended complaint. Defendant S & S subsequently filed its third-party complaint against Kelly on March 31, 1987.
On April 27, 1987, Kelly, as third-party defendant, filed its motion to dismiss S & S's third-party complaint. On the following date, April 28, 1987, Kelly sent notice to all attorneys of record that the circuit court would hear its motion on July 15, 1987. Again, we note that this court found the notice in the exhibits attached to Kelly's response as third party to plaintiff's motion for leave to file an amended complaint rather than in the court file. On May 13, 1987, S & S filed a motion to dismiss count I of plaintiff's complaint. S & S sent notice on May 28 that the hearing regarding its motion to dismiss was set on July 28. At the July 15 motion docket call, the circuit court ordered:
"Kelly Energy's Motion for Summary Judgment as to 3rd Party Plaintiff S & S's Roofing Third Party Complaint is hereby continued until July 28, 1987, 11:00 am, to be argued in conjunction with defendant S & S Roofing's Motion for Summary Judgment against Plaintiff, Loyola Academy."
However, we find that the circuit court may have been referring to S & S's motion to dismiss count I of plaintiff's complaint because it had disposed of the motion for summary judgment on November 17. Furthermore, the circuit court did not refer to any motion for summary judgment at the July 28, 1987, hearing.
On July 28, the circuit court granted Loyola 28 days to respond to S & S's motion to dismiss count I and granted S & S 14 days to file a reply. The circuit court, however, continued the hearing on S & S's motions to dismiss count I of plaintiff's complaint and to dismiss Kelly's third-party complaint to October 22, 1987. However, before the next scheduled hearing, plaintiff sent notice to all attorneys of record that a hearing was set for October 20, 1987, regarding its motion for leave to file instanter its first amended complaint. Plaintiff set the motion on the non-contested motion call docket. We again note that this court did not find the notice in the court file but in the exhibits to Kelly's response as third-party defendant to plaintiff's motion for leave to file an amended complaint. At the October 20, 1987, motion call, however, the court denied Loyola's motion for leave because it was contested by Kelly and S & S and, as such, should have been brought on the circuit court's regular contested motion docket call.
At the October 22, 1987, contested motion docket call hearing, Loyola made an oral motion to file instanter its first amended complaint. At the conclusion of the hearing the circuit court ordered:
"1) that Defendant, S & S Roof Maintenance, Inc.'s motion to dismiss Count I of Plaintiff's complaint is granted;

*1214 2) that Defendant Kelly Energy System's motion to dismiss third-party complaint is granted;
3) that oral motion of Plaintiff to file amended complaint instanter is denied without prejudice to file a written motion."
The circuit court denied Loyola's motion because of insufficient notice.
On October 28, 1987, Loyola again gave notice that it would move for leave to file an amended complaint before the circuit court on the routine, noncontested motion docket call of November 5, 1987. In light of the scanty record, this court can only discern that at that motion call, the circuit court denied the motion and reset it on the regular contested motion docket call. There is nothing in the record to show otherwise.
1988. On January 29, 1988, at the regular motion docket call, the circuit court granted Loyola 28 days to file its brief in support of its motion to file an amended complaint. Defendants were granted until March 25 to file a response. The circuit court continued the motion hearing to April 21, 1988.
On February 11, 1988, Kelly filed a motion to correct the order of October 22, 1987. Kelly requested that the circuit court provide that its dismissal of S & S's third-party complaint was with prejudice and that the order of the circuit court was final and appealable.
On February 16, 1988, the circuit court ordered:
"1) that Defendant, S & S Roof Maintenance, Inc.'s motion to correct order of October 22, 1987 is granted as to dismissing Count I with prejudice and said order is final and appealable.
2) that Defendant and Third Party Defendant, Kelly Energy System, Inc.'s motion to correct order of October 22, 1987 in regards to third party complaint is entered and continued to April 21, 1988 and Defendant, S & S Roof Maintenance, Inc. is given 28 days to respond to Kelly Energy Systems, Inc.'s motion to correct order of October 22, 1987."
On February 26, Loyola filed its motion for leave to file an amended complaint as well as its argument in support and attached its amended complaint. The amended complaint alleged four new counts, i.e., (1) breach of implied warranty for a particular purpose, (2) breach of implied warranty of merchantability, (3) breach of contractual sales agreement, and (4) violation of the Consumer Fraud and Deceptive Business Practices Act, against Kelly and S & S (Ill.Rev.Stat.1985, ch. 121½, par. 261 et seq.).
The defendants subsequently filed their response in opposition to Loyola's motion for leave to file an amended complaint. On April 12, 1988, S & S filed its response to Kelly's motion to correct the court order of October 22, 1987, requesting that the order not be made final and appealable. At the next scheduled hearing, April 21, 1988, the circuit court continued the cause to the July 14, 1988, contested motion docket call.
On July 14, 1988, the circuit court ordered: "Plaintiff's motion for leave to file an amended complaint is hereby denied. The court finds that this order is final and appealable." From this order, Loyola appealed. The court did not rule on the motion to correct the October 22, 1987, order. We note that the order of November 17, 1986, granting summary judgment in favor of S & S and Kelly was never made final and appealable.
The issue before this court is whether the circuit court abused its discretion when it denied plaintiff leave to amend its complaint after it had granted summary judgment for defendants. We initially point out that the procedures followed by all parties to this action are far from standard, but this court will attempt to address the issue at hand. We also point out that Kelly's motion in response as third-party defendant to plaintiff's motion for leave to file an amended complaint is more complete than our record file.
Pursuant to section 2-1005 of the Code of Civil Procedure, any party "may move with or without supporting affidavits for a summary judgment in his or her favor for all or any part of the relief *1215 sought" against him or her. (Ill.Rev.Stat. 1985, ch. 110, pars. 2-1005(a), (b).) Although the use of a summary judgment procedure is encouraged as an aid in expeditious disposition of a lawsuit, it is a drastic means of disposing of litigation and should only be allowed when the right of the moving party is clear and free from doubt. (Purtill v. Hess (1986), 111 Ill.2d 229, 240, 95 Ill.Dec. 305, 489 N.E.2d 867.) "In determining whether the moving party is entitled to summary judgment, the court must construe the pleadings, depositions, admissions and affidavits strictly against the movant and liberally in favor of the opponent." (In re Estate of Whittington (1985), 107 Ill.2d 169, 177, 90 Ill.Dec. 892, 483 N.E.2d 210; Tersavich v. First National Bank & Trust (1991), 143 Ill.2d 74, 80-81, 156 Ill.Dec. 753, 571 N.E.2d 733.) In short, "[a] motion for summary judgment is to be decided on the basis of the record as it exists at the time the motion is heard." Logan v. Old Enterprise Farms, Ltd. (1990), 139 Ill.2d 229, 237, 151 Ill.Dec. 323, 564 N.E.2d 778.
Furthermore, it is well established that in deciding a motion for summary judgment, the court may draw inferences from the undisputed facts. However, where reasonable persons could draw divergent inferences from the undisputed facts, the issue should be decided by the trier of fact and the motion should be denied. (Pyne v. Witmer (1989), 129 Ill.2d 351, 358, 135 Ill.Dec. 557, 543 N.E.2d 1304.) In light of the standard, the trial court does not have any discretion in deciding the matter. (Derby Meadows Utility Co. v. Inter-Continental Real Estate (1990), 202 Ill. App.3d 345, 354, 147 Ill.Dec. 646, 559 N.E.2d 986.) In cases involving contracts, there is a disputed fact precluding summary judgment when the material writing contains an ambiguity which requires admission of extrinsic evidence. Ebert v. Dr. Scholl's Foot Comfort Shops, Inc. (1985), 137 Ill.App.3d 550, 558, 92 Ill.Dec. 323, 484 N.E.2d 1178.
In this case, the circuit court granted summary judgment but did not make the order final and appealable. Thus, the issue of whether the trial court properly granted summary judgment is not before this court. It was after this point that plaintiff attempted to file an amended complaint. Pursuant to section 2-1005(g), the trial court shall permit pleadings to be amended upon just and reasonable terms before or after the entry of summary judgment. (Ill.Rev.Stat.1987, ch. 110, par. 2-1005(g).) Section 2-1005(g) "reaffirms the power of the court to permit amendments to pleadings at any time, as mandated by section 2-616(a) of the Civil Practice Law." (Ill.Ann.Stat, ch. 110, par. 2-1005, Supplement to Historical & Practice Notes, at 31 (Smith-Hurd Supp.1991); Ill.Rev.Stat.1987, ch. 110, par. 2-616(a).) Furthermore, since the "`just and reasonable' terms of section 2-1005(g) mirror the language used in section 2-616(a) [citation] [it] has been interpreted as requiring the trial court to permit amendment if it will further the ends of justice." Seibert v. Continental Oil Co. (1987), 161 Ill.App.3d 891, 895, 113 Ill.Dec. 743, 515 N.E.2d 728.
Section 2-616 of the Civil Practice Law provides, in part:
"(a) At any time before final judgment amendments may be allowed on just and reasonable terms, * * * changing the cause of action * * * or adding new causes of action * * *, in any matter, either of form or substance, in any process, pleading, bill of particulars or proceedings, which may enable the plaintiff to sustain the claim for which it was intended to be brought * * *.
* * * * * *
(c) A pleading may be amended at any time, before or after judgment, to conform the pleadings to the proofs, upon terms as to costs and continuance that may be just." (Emphasis added.) Ill. Rev.Stat.1987, ch. 110, pars. 2-616(a), (c).
In order to determine whether the trial court has abused its discretion, we must look at four factors established in Kupianen v. Graham (1982), 107 Ill. App.3d 373, 63 Ill.Dec. 125, 437 N.E.2d 774, and adopted by this court. These factors are: (1) whether the proposed amendment *1216 would cure the defective pleading; (2) whether other parties would sustain prejudice or surprise by virtue of the proposed amendment; (3) whether the proposed amendment is timely; and (4) whether previous opportunities to amend the pleading could be identified. (Kupianen, 107 Ill. App.3d at 377, 63 Ill.Dec. 125, 437 N.E.2d 774.) We will not make any determination that will construe an act of the legislature so as to lead to absurd, inconvenient or unjust consequences. McCastle v. Sheinkop (1987), 121 Ill.2d 188, 193, 117 Ill.Dec. 132, 520 N.E.2d 293, citing People ex rel Cason v. Ring (1968), 41 Ill.2d 305, 312-13, 242 N.E.2d 267.
Since a "trial court has broad discretion in motions to amend pleadings prior to entry of final judgment," this court will not find that denial of a motion to amend is prejudicial error unless there has been a manifest abuse of such discretion. (Mundt v. Ragnar Benson, Inc. (1975), 61 Ill.2d 151, 160-61, 335 N.E.2d 10, citing Austin Liquor Mart, Inc. v. Department of Revenue (1972), 51 Ill.2d 1, 8, 280 N.E.2d 437; Old Salem Chautauqua Association v. Illinois District Council of the Assembly of God (1958), 13 Ill.2d 258, 266, 148 N.E.2d 777; Deasey v. City of Chicago (1952), 412 Ill. 151, 156, 105 N.E.2d 727.) "[J]udicial discretion must be exercised within the bounds of the law [citation] and any question regarding the proper exercise thereof is always subject to our review [citation]. Further, where the exercise of discretion has been frustrated by the application of an erroneous rule of law, review is required to permit the exercise in a manner `"consistent with the law."`" People v. Brockman (1991), 143 Ill.2d 351, 363-64, 158 Ill.Dec. 513, 574 N.E.2d 626.
Regarding the first element, we find that the amendment will cure the defective pleading. We note that the original complaint contained no evidence of any type of warranty until plaintiff filed a copy of a brochure regarding the specifications and warranty attached to its motion for leave to file an amended complaint.
Furthermore, in the original complaint, count I alleges negligence against S & S and count II alleges breach of implied warranty of merchantability against S & S. Count III alleges breach of an express warranty against Kelly. Comparatively, the amended complaint consists of four new counts alleging various theories against Kelly and S & S. Count I alleges breach of implied warranty of fitness for a particular purpose against Kelly and S & S. Count II alleges breach of implied warranty of merchantability against Kelly and S & S. Count III alleges breach of contract against Kelly and S & S. Count IV alleges a violation of the Consumer Fraud and Deceptive Business Practices Act against Kelly only. The amended complaint provides more specific allegations, i.e., expands on the original complaint. Moreover, the materiality of the amendment is apparent and denial thereof will work a substantial injustice. (People ex rel. Hamer v. Jones (1968), 39 Ill.2d 360, 371, 235 N.E.2d 589.) Therefore, we find that the amended complaint did cure the defective pleading.
The next factor is whether other parties would sustain prejudice or surprise by virtue of the proposed amendment. This court does not find any prejudice or surprise. First, plaintiff attempted to amend the complaint several times prior to the eventual hearing on the matter. Although plaintiff did not set the motion on the proper docket call each time, the parties did have notice of plaintiff's intention as evidenced by the exhibit in Kelly's response as third party to plaintiff's motion for leave to file an amended complaint. Furthermore, the parties knew of plaintiff's motion approximately 17 months after this cause was filed and only two months after the circuit court entered the order granting summary judgment in favor of Kelly and S & S. More importantly, plaintiff gave notice of its intention while this cause was still in the pleading stage. This cause was not near any established trial date. (See First National Bank & Trust Co. v. Sousanes (1978), 66 Ill.App.3d 394, 23 Ill.Dec. 394, 384 N.E.2d 30.) In light of these facts, the parties had notice of plaintiff's intention *1217 over a year and a half prior to the July 14, 1988, hearing on the matter.
The next factor is the timeliness of the proposed amendment. We find that the proposed amendment was timely filed. Although plaintiff did not place the motion on the proper docket call at the earlier attempts, the parties had adequate notice of the intention of the plaintiff. Furthermore, plaintiff filed the motion only 17 months after it filed this cause and only two months after the order granting summary judgment in favor of Kelly and S & S. Most importantly, plaintiff filed its intent to amend within the pleading stage. Plaintiff did not file after an unreasonable length of time. See Mundt v. Ragnar Benson, Inc. (1975), 61 Ill.2d 151, 335 N.E.2d 10.
The last factor is whether previous opportunities to amend could be identified. In light of our previous discussions, we find that plaintiff did try several times to amend, although improperly. Since the first attempt was two months after the order granting summary judgment in favor of Kelly and S & S, we find that it was a reasonable first opportunity, although not necessarily the only opportunity.
In light of the fact that the amendment did meet all four factors, we find that the denial of the motion to amend was prejudicial error as a result of a manifest abuse of discretion. To hold otherwise would mean a construction of section 2-616 leading to an absurd, inconvenient and unjust consequence. More importantly, we find that the amendment was material, and its materiality is apparent. Jones, 39 Ill.2d at 371, 235 N.E.2d 589.
We also point out that the record reveals that the circuit court permitted defendants leave whenever they requested it. As such, this court finds that plaintiff deserves the same consideration.
Thus, we find that the trial court abused its discretion when it denied plaintiff's motion for leave to file an amended complaint. The judgments of the appellate and circuit courts are reversed, and the cause is remanded for further proceedings not inconsistent with this opinion.
Judgments reversed; cause remanded.
