
683 A.2d 506 (1996)
MONOPOLY, INC.
v.
Charles ALDRICH et al.
Supreme Judicial Court of Maine.
Submitted on Briefs September 11, 1996.
Decided October 15, 1996.
*507 Adrian P. Kendall, Thompson, McNaboe, Ashley & Bull, Portland, for Plaintiff.
David J. Van Baars, Shankman & Associates, Lewiston, for Defendants.
Before WATHEN, C.J., and ROBERTS, GLASSMAN, CLIFFORD, RUDMAN, and LIPEZ, JJ.
RUDMAN, Justice.
Monopoly, Inc. appeals from the judgment entered in the Superior Court (Cumberland County, Mills, J.) after a non-jury trial. Monopoly argues that testimony at the trial explicitly contradicts the written representations of facts on which the court (Cumberland County, Brodrick, J.) earlier granted a partial summary judgment and that the trial court abused its discretion in failing to correct the partial summary judgment. Charles Aldrich and Corlie Monaghan cross-appeal from (1) the denial of their motion for a summary judgment on the issue of whether Monopoly wrongfully withheld their security deposit pursuant to 14 M.R.S.A. § 6034(2) (Supp.1995), (2) the denial of their motion pursuant to M.R.Civ.P. 12(c) for a judgment on the pleadings of Monopoly's complaint, (3) the denial of their full attorney fees, and (4) the court's granting of Monopoly's motion *508 pursuant to M.R.Civ.P. 15(b) to amend its complaint to conform to the evidence of mitigation of damages. Finding no error, we affirm.
Testimony at the trial established the following undisputed facts. In January 1994 Aldrich and Monaghan [1] entered into a written agreement with Monopoly to lease an apartment on Fore Street in Portland. The Aldriches paid Monopoly $1800, $900 for one month's advance rent and $900 as a security deposit. The lease provided that the rental term would begin March 1, 1994, and terminate February 28, 1995. Under the terms of the lease the Aldriches reserved the right to terminate the lease if possession of the premises was not delivered within 30 days of March 1, 1994. The lease prohibited modification except by a writing signed by both parties.
At the time Monopoly and the Aldriches entered into the lease, renovations to the apartment were unfinished. The parties agreed to a floor plan for the apartment. Monopoly went ahead with the construction work, the scope of which work was later changed at the Aldriches' request. The apartment, however, was not ready for occupancy by the April 1, 1994, deadline. On April 5, 1994, the Aldriches notified Monopoly of their intent to terminate the lease and demanded return of their $1800. A tangle of litigation, characterized by the court as having "an unfortunate procedural history," ensued.
The litigation was commenced by Joseph Soley, president of Monopoly, Inc., pro se by instituting an action in his own name against the Aldriches claiming a breach of the lease by the Aldriches and seeking reimbursement for expenses incurred in renovating the apartment. The Aldriches responded with a third-party complaint against Monopoly claiming a violation of the Unfair Trade Practices Act as well as a breach of the lease agreement and seeking return of their deposit and attorney fees.
The Aldriches moved for summary judgments against Plaintiff Soley and Third-party Defendant Monopoly. Monopoly, represented by counsel, filed a response opposing the Aldriches' motion but did not raise the issue of the propriety of the Aldriches' third-party complaint nor did it offer any statement of facts or affidavits to dispute the Aldriches' representation of the facts.
On the basis of the Aldriches' undisputed statement of the material facts, the court granted the Aldriches a summary judgment against Soley and a partial summary judgment against Monopoly and awarded the Aldriches return of their advance rent and security deposit plus attorney fees and costs. The court reserved for trial only the issue of whether Monopoly's retention of the security deposit was wrongful, which if proved would trigger double damages pursuant to 14 M.R.S.A. § 6034(2) (Supp.1995).[2]
Soley, meanwhile, prior to the entry of these summary judgments, had moved in concert with Monopoly to amend his original complaint to substitute Monopoly as plaintiff and to allow Monopoly to assert a claim against the Aldriches for reimbursement of construction expenses and "rent." The Aldriches did not object to this amendment. Three months after entry of the summary judgments, the court (Cumberland County, Mills, J.) granted the motion to amend the complaint and deemed Monopoly's complaint filed as of the date the court granted the motion to amend. The Aldriches then filed a motion for judgment on the pleadings with respect to the amended complaint on the ground that the court's express findings in relation to the partial summary judgment against Monopoly precluded judgment for Monopoly. Monopoly moved to dismiss the Aldriches' third-party complaint against Monopoly on the ground of improper third-party *509 practice. The court took both parties' motions under advisement.
The case then proceeded to trial and in the course of her trial testimony, Corlie Aldrich acknowledged that the Aldriches had agreed with Monopoly to extend the renovation deadline to April 15. At the close of the testimony, Monopoly notified the court that in light of Mrs. Aldrich's testimony Monopoly would file a motion asking the court to reconsider the partial summary judgment on the ground that the Aldriches' statement of material facts and affidavit in support of the motion for a summary judgment misrepresented the facts. Monopoly further moved pursuant to M.R.Civ.P. 15(b) to amend its pleadings to conform to testimony concerning Monopoly's efforts to mitigate lost rent damages. The Aldriches objected and moved pursuant to M.R.Civ.P. 50 for judgment as a matter of law on the issues of the wrongful retention of their deposit and their obligation to reimburse Monopoly for construction expenses. The court added these motions to those already under advisement.
One week later, on the same day that Monopoly filed a motion for reconsideration of the partial summary judgment, the court (1) granted Monopoly's motion to amend its pleadings to conform to the evidence as to the mitigation of damages, (2) granted the Aldriches' motion for judgment as a matter of law with respect to their $1800 advance rent/deposit and their lack of liability for reimbursement of Monopoly's expenses, (3) denied the Aldriches' motion for judgment as a matter of law with respect to Monopoly's allegedly wrongful retention of the $900 security deposit, and (4) denied the parties' other motions.
Following the court's denial of Monopoly's motion for reconsideration of the partial summary judgment and Monopoly's motion for a new trial, reconsideration, or relief from the judgment, Monopoly appealed from the judgment and the Aldriches cross-appealed.

I
We first consider Monopoly's assertion that the court abused its discretion in not reconsidering the partial summary judgment granted to the Aldriches. When the Aldriches moved for a summary judgment on their third-party complaint against Monopoly and offered in support of their motion both a statement of facts asserting that the renovation deadline had not been extended and an affidavit signed by Charles Aldrich that he had not agreed to any modification of the deadline, Monopoly offered no opposing statement of facts and no opposing affidavits or other evidence to show that the parties had agreed to extend the deadline to April 15. Given the undisputed "fact" of the April 1 renovation deadline, the court appropriately granted to the Aldriches a partial summary judgment on the ground that they had withdrawn from the lease as a matter of right. As a matter of law, Monopoly must bear the consequence of a partial summary judgment pursuant to M.R.Civ.P. 56(c) for having failed to provide evidence of any genuine issue of material fact as to the agreement to extend the deadline.
Monopoly argues, and the Aldriches do not dispute, that the trial court has discretion to reconsider a motion for partial summary judgment. An order adjudicating less than all claims in a case, absent the discretion of a final judgment, is subject to revision at any time before the entry of judgment adjudicating all the claims and all the rights and liabilities of the parties. M.R.Civ.P. 54(b)(1); [3]Bacon v. Penney, 418 A.2d 1136, *510 1140 n. 4 (Me.1980). Rule 54 requires no motion by a party before an order adjudicating less than all claims and rights may be revised. The court's order on the Aldriches' third-party claim grants only a partial summary judgment and directs no entry of a final judgment on all the Aldriches' claims. Revision of the partial summary judgment here remained within the discretion of the trial court until the entry of the final judgment.
The court's discretion to revise a ruling by another justice in the same case is bounded by the doctrine of the law of the case.
The doctrine of the "law of the case" rests on the sound policy that in the interest of finality and intra-court comity a Superior Court justice should not, in subsequent proceedings involving the same case, overrule or reconsider the decision of another justice.... The rule does not serve as a complete bar to reconsideration of an issue when the prior ruling is provisional or lacks clarity, or the error is of such character that it should be corrected at trial.
Grant v. City of Saco, 436 A.2d 403, 405 (Me.1981) (citations omitted).
On the basis of this record and in light of Monopoly's failure to respond properly to the Aldriches' motion for a summary judgment, the trial court was well within the bounds of its discretion in declining to revise the partial summary judgment.

II
The Aldriches have cross-appealed from the court's denial of their motion for a summary judgment on the issue of whether Monopoly wrongfully withheld their security deposit. The court's partial denial of the Aldriches' motion for a summary judgment is not a proper subject for appellate review because the case proceeded to trial, where the issue of wrongful retainer of the deposit was decided on the merits.
We have consistently held that the denial of a motion for summary judgment is not a proper subject for appellate review where, as here, the case has proceeded to a trial or hearing on the merits.
Estate of Galluzzo, 615 A.2d 236, 238 (Me. 1992) (citations omitted). The principles underlying this rule provide no ground for distinguishing its application to the denial of a partial as opposed to full motion for a summary judgment. See Bigney v. Blanchard, 430 A.2d 839, 842-43 (Me.1981). Thus, the Aldriches' cross-appeal from the court's denial of their motion as third-party plaintiffs for summary judgment must fail.
Similarly, the Aldriches' cross-appeal from the court's denial of their motion for judgment on the pleadings on Monopoly's claim for reimbursement of construction expenses and rent must fail. When, as here, a motion for judgment on the pleadings is filed by a defendant, only the legal sufficiency of the complaint is tested. Cunningham v. Haza, 538 A.2d 265, 267 (Me.1988). A complaint is not dismissed for insufficiency of the claim unless "it appears to a certainty" that under no facts that could be proved in support of the claim is the plaintiff entitled to relief. Id. Although its claim later failed for lack of proof, Monopoly's complaint did state a cause of action. Thus, the court did not err as a matter of law in denying Aldriches' motion for a judgment on the pleadings with respect to Monopoly's complaint.
The Aldriches cross-appeal from the court's denial of any further attorney fees beyond those awarded to them in the partial summary judgment. We review a trial court's award of attorney fees for an abuse of discretion. Gibson v. Farm Family Mut. Ins. Co., 673 A.2d 1350, 1354 (Me.1996). "The general rule is that a party to a lawsuit, with very limited exceptions, may not recover attorney fees incurred in prosecuting a breach of contract case." Id. Although a party has no general right to attorney fees, they may be provided for by a specific agreement of the parties. See Bank of Maine, N.A. v. Weisberger, 477 A.2d 741, 744-45 *511 (Me.1984); see also Dodge v. United Servs. Auto. Ass'n, 417 A.2d 969, 975-76 (Me.1980).
The court's authority to award attorney fees here turns on construction of the terms of the lease provision governing attorney fees. Here the award of attorney fees is governed by an explicit term of the lease contract. The lease agreement provides:
In case suit should be brought for recovery of the premises, or for any sum due hereunder, or because of any act which may arise out of the possession of the premises, by either party, the prevailing party shall be entitled to all costs incurred in connection with such action, including a reasonable attorney's fee.
The trial court denied the Aldriches any further attorney fees beyond those awarded in the partial summary judgment on the ground that "the defendants have not prevailed in their additional claim for double damages." The lease contract itself does not define "prevailing party." This Court, however, in the similar context of awarding trial costs pursuant to the rules of civil procedure, has interpreted the term "prevailing party" as unambiguous and meaning a party prevailing with reference to the suit as a whole.
As we stated in Inhabitants of Sabattus v. Bilodeau, Me., 395 A.2d 123, 124 (1978):
Who is the prevailing party is to be determined by a functional analysis, rather than a mechanical application of... [the rule governing costs].
By a "functional analysis" we meant that one must look at the lawsuit as a whole to determine which party was the "winner" and which the "loser."
Dodge v. United Servs. Auto. Ass'n, 417 A.2d at 974-75. The trial court concluded that the Aldriches' security deposit was not willfully withheld. Thus, the Aldriches did not prevail in their additional claim for double damages and the court properly declined to award them attorney fees pursuant to the lease or 14 M.R.S.A. § 6034(2).
In light of our affirmance of the judgment in favor of the Aldriches on Monopoly's claim for damages/rent, we need not discuss the appropriateness of the court's granting Monopoly's motion to amend its pleadings.
The entry is:
Judgment affirmed.
All concurring.
NOTES
[1]  Aldrich and Monaghan later married and are hereafter referred to as "the Aldriches."
[2]  14 M.R.S.A. § 6034(2) (Supp.1995) provides:

2. Double damages for wrongful retention.
The wrongful retention of a security deposit in violation of this chapter renders a landlord liable for double the amount of that portion of the security deposit wrongfully withheld from the tenant, together with reasonable attorney's fees and court costs.
[3]  M.R.Civ.P. 54(b)(1) provides:

Except as otherwise provided in paragraph (2) of this subdivision [regarding attorney fees] and in Rule 80(d) [regarding attorney fees], when more than one claim for relief is presented in an action, whether as a claim, counterclaim, cross-claim, or third-party claim, or when multiple parties are involved, the court may direct the entry of a final judgment as to one or more but fewer than all of the claims or parties only upon an express determination that there is no just reason for delay and upon an express direction for the entry of judgment. In the absence of such determination and direction, any order or other form of decision, however designated, except those enumerated in paragraph (2) of this subdivision and in the last sentence of Rule 80(d), which adjudicates less than all the claims or the rights and liabilities of less than all the parties shall not terminate the action as to any of the claims or parties, and the order or other form of decision is subject to revision at any time before the entry of judgment adjudicating all the claims and the rights and liabilities of all the parties.
