
46 So.3d 884 (2010)
Ex parte Susan S. DEPAOLA, trustee in bankruptcy for Clifford H. Willcutt III.
(In re Danny Clements Builder, Inc.
v.
Clifford H. Willcutt III).
1071620.
Supreme Court of Alabama.
February 12, 2010.[*]
Rehearing Denied April 9, 2010.
Richard A. Lawrence, Montgomery; and Scott Johnson, Montgomery, for petitioner.
Joseph Seawell Moore and John G. Smith of Balch & Bingham, LLP, Montgomery, for respondent.
WOODALL, Justice.
Clifford H. Willcutt III petitioned this Court for a writ of mandamus, seeking relief from the trial court's denial of Willcutt's motions to amend his answer and counterclaims in an action Danny Clements Builder, Inc. ("Clements Builder"), filed against Willcutt in the Montgomery Circuit Court. On September 10, 2008, Willcutt filed in this Court a suggestion of bankruptcy, and on September 15, 2008, this Court placed Willcutt's petition on its *885 administrative docket. On November 19, 2008, Susan S. DePaola, as Willcutt's bankruptcy trustee, filed a notice of substitution of party, substituting the trustee for Willcutt as the petitioner. DePaola, as Willcutt's trustee in bankruptcy, now pursues Willcutt's petition for mandamus relief. We deny the petition.

Facts and Procedural History
In December 2005, Willcutt contracted with Clements Builder for the construction of a commercial building in Montgomery. In March 2007, after constructing the building, Clements Builder sued Willcutt, alleging that Willcutt owed it approximately $22,000 in unpaid construction costs. Willcutt answered the complaint and filed several counterclaims against Clements Builder. In his counterclaims, Willcutt alleged that Clements Builder (1) had been overpaid for its work; (2) had breached the contract by failing to follow the contract plans with respect to exterior wall studs, electrical panels, louver vents, and a driveway; (3) had fraudulently misrepresented facts regarding the elevation of the building; and (4) had fraudulently misrepresented facts related to the installation of a fireplug.
In May 2007, the trial court entered a scheduling order, setting the case for trial on November 26, 2007, and stating that discovery had to be completed by November 5, 2007. On November 16, 2007, after the close of discovery and only 10 days before the scheduled trial, Willcutt filed a "Second Amendment to Counterclaim," seeking leave of court to add a demand for attorney fees. Three days later, on November 19, Willcutt filed a "Third Amendment to Counterclaim," seeking leave of court to add a claim that Clements Builder had breached the contract in another manner by improperly installing anchor bolts in the building. On that same day, Willcutt also sought to amend his answer to add a claim for attorney fees. Clements Builder moved the trial court to strike each of the requested amendments, arguing that Willcutt had not demonstrated good cause for the amendments and that Clements Builder "would be substantially prejudiced if it is forced to defend new claims that it did not have an opportunity to explore during the discovery process." (Emphasis in original motion.)
On November 20, 2007, the trial court continued the trial date because of a scheduling conflict. On March 14, 2008, the trial court held a hearing on all the pending motions. At the hearing, the trial court orally denied Willcutt's motions to amend his answer and counterclaims. The trial court stated that the amendments were untimely because discovery was closed and because Willcutt knew or should have known of his new counterclaims for attorney fees and alleging breach of contract well in advance of the time he filed his motions to amend.
In April 2008, Willcutt petitioned this Court for mandamus relief from the trial court's ruling. This Court dismissed Willcutt's petition on the ground that the trial court's oral ruling was not an "order," under Rule 58(a), Ala. R. Civ. P.[1] On August 19, 2008, the trial court entered a written order denying Willcutt's motions to amend his answer and counterclaims. On August 29, 2008, Willcutt again petitioned *886 this Court for a writ of mandamus directing the trial court to grant his motions for leave to amend his answer and counterclaims. DePaola, as Willcutt's trustee in bankruptcy, now pursues Willcutt's second petition for mandamus relief. We deny the petition.

Standard of Review
"Mandamus is an extraordinary remedy and will be granted only where there is `(1) a clear legal right in the petitioner to the order sought; (2) an imperative duty upon the respondent to perform, accompanied by a refusal to do so; (3) the lack of another adequate remedy; and (4) properly invoked jurisdiction of the court.'"
Ex parte Ocwen Fed. Bank, FSB, 872 So.2d 810, 813 (Ala.2003) (quoting Ex parte Alfab, Inc., 586 So.2d 889, 891 (Ala.1991)). "A writ of mandamus, being a drastic and extraordinary remedy, will issue to correct a trial court's ruling regarding the amendment of pleadings only when it is shown that the trial court has exceeded its discretion." Ex parte Liberty Nat'l Life Ins. Co., 858 So.2d 950, 952 (Ala.2003).

Analysis
This Court has stated:
"Rule 15(a), Ala. R. Civ. P., reflects Alabama's liberal policy in favor of allowing amendments to pleadings:
"`Unless a court has ordered otherwise, a party may amend a pleading without leave of court, but subject to disallowance on the court's own motion or a motion to strike of an adverse party, at any time more than forty-two (42) days before the first setting of the case for trial, and such amendment shall be freely allowed when justice so requires. Thereafter, a party may amend a pleading only by leave of court, and leave shall be given only upon a showing of good cause....'
"....
"We noted in Ex parte GRE Insurance Group, 822 So.2d 388, 390 (Ala. 2001), that under Rule 15 amendments to pleadings are to be `freely allowed' unless there exists some valid reason to deny them, such as `actual prejudice or undue delay[.]'
"....
"When, as here, the amendment is sought within the 42-day window, the trial court is free to deny a party leave to amend his or her pleading unless the party can demonstrate `good cause.'... However, in light of the overarching liberal policy of allowing amendments under Rule 15, the appropriate way to view the request for leave to amend, if a party demonstrates `good cause,' is as though the request had been brought more than 42 days before trial, when the trial court does not have `unbridled discretion' to deny the leave to amend, but can do so only upon the basis of a `valid ground' as stated above."
Liberty National, 858 So.2d at 953-54.
In Blackmon v. Nexity Financial Corp., 953 So.2d 1180, 1189 (Ala.2006), this Court noted:
"Rule 15[, Ala. R. Civ. P.,]' "is not carte blanche authority to amend ... at any time."' Burkett v. American Gen. Fin., Inc., 607 So.2d 138, 141 (Ala.1992) (quoting Stallings v. Angelica Uniform Co., 388 So.2d 942, 947 (Ala.1980)).... The trial court can refuse to allow an amendment if allowing it would result in actual prejudice to the opposing party or for reasons of `undue delay.' [Ex parte] GRE Ins. Group, 822 So.2d [388,] 390 [(Ala.2001) ].
"Undue delay can have two different meanings in a case. First, the trial court has discretion to deny an amendment *887 to a pleading if allowing the amendment would unduly delay the trial. Second, an unexplained undue delay in filing an amendment when the party has had sufficient opportunity to discover the facts necessary to file the amendment earlier is also sufficient grounds upon which to deny the amendment."
The Court in Blackmon went on to say that the trial court had not exceeded its discretion in denying Blackmon's motion to amend his complaint because the trial court had found that "Blackmon was aware of the facts justifying the amended complaint when he filed his original complaint," and because the trial court had found that "the amendment would require additional discovery and would substantially delay the trial setting." Id. at 1189-90.
DePaola argues that Willcutt demonstrated good cause for the delay in amending his answer and counterclaims and that Clements Builder would not be prejudiced if the trial court allowed the amendments. DePaola also argues that there is still time for discovery and that the facts regarding the new claims are within Clements Builder's knowledge. However, at the hearing on Willcutt's motions to amend, Clements Builder argued that it would "be prejudiced by [Willcutt's] claims because [it had] not had an opportunity to conduct discovery in regard to [those claims]." The trial court agreed, stating:
"I think they're right. I mean, discovery is closed. You know, I think they make a good point. We've already answered. We've already amended. I don't think that it would be proper for me to grant that because discovery is closed...."
(Emphasis added.) With regard to Willcutt's new breach-of-contract claim, the trial court went on to say:
"You already know there's problems. You can't come in here and say, `Judge, we didn't know [about the breach-of-contract claim] until [the anchor bolts] were dug up and we found out that it wasn't done correctly.'
"Well, here's evidence right here [from Willcutt's October 1, 2007, deposition testimony] that it hadn't been done correctly.... That they weren't screwing things in right; that they were using the wrong size screw; that they weren't lining up the plates; that they were using the torch to make them fit. What about all of this? Is this not a problem?"
The trial court concluded that Willcutt was "on notice that there were problems with the construction of that building," such that Willcutt should have conducted discovery on that issue earlier, and that Willcutt was "on notice about those attorney's fees.... So y'all lose on those two issues."
It appears that in this case, as in Blackmon, the trial court determined that Willcutt "had sufficient opportunity to discover facts necessary to file the amendment[s] earlier," Blackmon, 953 So.2d at 1189, and that Clements Builder would suffer prejudice if the motions to amend were granted. These reasons constitute "valid grounds" under Rule 15, Ala. R. Civ. P., and under our caselaw addressing motions to amend pleadings filed within 42 days of trial. See Liberty National, 858 So.2d at 953 ("[U]nder Rule 15 amendments to pleadings are to be `freely allowed' unless there exists some valid reason to deny them, such as `actual prejudice or undue delay'...."). Because the trial court's decision was based on valid grounds adequately supported by the evidence before it, DePaola has not demonstrated that the trial court exceeded its discretion in denying Willcutt's *888 motions. Therefore, we deny the petition for the writ of mandamus.
PETITION DENIED.
COBB, C.J., and SMITH, PARKER, and SHAW, JJ., concur.
NOTES
[*]  Note from the reporter of decisions: This opinion was released by the Supreme Court under the date February 12, 2010. This case was actually released to the public on February 16, 2010.
[1]  Rule 58(a), Ala. R. Civ. P., provides:

"A judge may render an order or a judgment: (1) by executing a separate written document, (2) by including the order or judgment in a judicial opinion, (3) by endorsing upon a motion the words `granted,' `denied,' `moot,' or words of similar import, and dating and signing or initialing it, (4) by making or causing to be made a notation in the court records, or (5) by executing and transmitting an electronic document to the electronic-filing system."
