In an action, inter alia, to recover a down payment on a contract for the sale of real property, (1) the defendants appeal from an order of the Supreme Court, Dutchess County (Pagones, J.), dated October 28, 2008, (2) the defendants Steven L. Tarshis and Tarshis, Catania, Liberth, IVlahon & Milligram, PLLC, appeal, as limited by the brief, from so much of an amended order of the same court dated February 24, 2009, as denied their cross motion for summary judgment dismissing the complaint insofar as asserted against them, the defendant Elm Farm Associates, LLC, appeals, as limited by the brief, from so much of the amended order as denied those branches of its cross motion which were for summary judgment dismissing the cause of action for attorneys’ fees and costs against it, and the plaintiffs cross-appeal, as limited by their brief, in effect, from so much of the amended order as denied those branches of their motion which were for summary judgment on their cause of action for attorneys’ fees and costs against the defendant Elm Farm Associates, LLC, and on their cause of action against the defend*668ants Steven L. Tarshis, and Tarshis, Catania, Liberth, Mahon & Milligram, PLLC, to recover damages based on an alleged breach of a fiduciary duty, and (3) the defendant Elm Farm Associates, LLC, appeals from a judgment of the same court, also dated February 24, 2009, which, upon so much of the amended ordér as granted that branch of the plaintiffs’ motion which was for summary judgment on their cause of action to recover the down payment and as denied that branch of its cross motion which was for summary judgment dismissing that cause of action, is in favor of the plaintiffs and against it in the principal sum of $150,000. The notice of appeal of the defendant Elm Farm Associates, LLC, from so much of the amended order as granted that branch of the plaintiffs’ motion which was for summary judgment on their cause of action to recover the down payment, and denied that branch of its cross motion which was for summary judgment dismissing that cause of action, is deemed a notice of appeal from the judgment (see CPLR 5512 [a]).
Ordered that the appeal from the order is dismissed, without costs or disbursements, as that order was superseded by the amended order; and it is further,
Ordered that the amended order is modified, on the law, by deleting the provision thereof denying that branch of the plaintiffs’ motion which was for summary judgment on the cause of action for attorneys’ fees and costs against the defendant Elm Farm Associates, LLC, and substituting therefor a provision granting that branch of the plaintiffs’ motion; as so modified, the amended order is affirmed insofar as appealed and cross-appealed from, without costs or disbursements; and it is further,
Ordered that the judgment is affirmed, without costs or disbursements; and it is further,
Ordered that the matter is remitted to the Supreme Court, Dutchess County, to determine the amount of attorneys’ fees and costs to be awarded to the plaintiffs payable by the defendant Elm Farm Associates, LLC.
“ ‘[W]hen parties set down their agreement in a clear, complete document, their writing should as a rule be enforced according to its terms’ ” (Signature Realty, Inc. v Tallman, 2 NY3d 810, 811 [2004], quoting R/S Assoc. v New York Job Dev. Auth., 98 NY2d 29, 32 [2002]; see Goldstein v AccuScan, Inc., 2 NY3d 811, 812 [2004]). The interpretation of an unambiguous contract is “the function of the court” (Jackson & Wheeler, Inc. v Village of Pleasantville, 56 AD3d 723, 724 [2008]). Where an agreement is clear and unambiguous, the parties’ intent “must be gleaned from the four corners of the relevant agreement” *669(Jackson & Wheeler, Inc. v Village of Pleasantville, 56 AD3d at 724-725).
Here, the agreement is clear and unambiguous and it can be determined from its four corners that the contracting parties intended the purchaser to recover the down payment upon a permissible termination of the agreement. Accordingly, the Supreme Court properly granted that branch of the plaintiffs’ motion which was for summary judgment on its cause of action to recover the down payment. Since the purchaser was the “prevailing party” in this dispute, it was entitled to recover against the defendant seller attorneys’ fees and costs, pursuant to section 29 of the agreement. Thus, the Supreme Court should have granted that branch of the plaintiffs’ motion which was for summary judgment on their cause of action against the defendant seller for attorneys’ fees and costs. Accordingly, we remit the matter to the Supreme Court, Dutchess County, for a determination of attorneys’ fees and costs.
The Supreme Court properly denied that branch of the plaintiffs’ motion which was for summary judgment on their cause of action against the defendants Steven L. Tarshis and Tarshis, Catania, Liberth, Mahon & Milligram, PLLC (hereinafter together the escrow agent), to recover damages based on an alleged breach of a fiduciary duty, and properly denied that branch of the escrow agent’s cross motion which was for summary judgment dismissing that cause of action. Pursuant to section 36 of the agreement, the contracting parties agreed, in pertinent part, to hold harmless the escrow agent except with respect to actions taken in bad faith, in willful disregard of the agreement, or involving gross negligence. The plaintiffs failed to demonstrate that the escrow agent violated its fiduciary duty, and acted in bad faith, in willful disregard of the agreement, or in gross negligence, by releasing a portion of the down payment to the defendant seller and, therefore, failed to establish their prima facie entitlement to judgment as a matter of law (see CPLR 3212). Likewise, the escrow agent failed to demonstrate its prima facie entitlement to judgment as a matter of law dismissing that cause of action (see CPLR 3212). Rivera, J.P., Leventhal, Lott and Austin, JJ., concur.