Appeal from a judgment of the County Court of Madison County, entered March 12, 1975, upon a decision of the court at a Trial Term without a jury. The sole issue raised on this appeal is whether the court erred in finding that the defendants, by withholding progress payments and insisting on work not called for in the agreement between the parties, breached the contract and damaged the plaintiff in the amount determined by the court. Plaintiff, a building contractor, and defendants, homeowners, contracted on August 21, 1971 for the remodeling of defendants’ home in accordance with architectural plans incorporated into their agreement. The work to be *710performed by plaintiff was particularized in the contract and priced at the sum of $12,790. Electrical work, heating, insulation and painting, along with kitchen cabinets, were specifically excluded as work to be done by plaintiff. The contract included an estimate, separate and distinct from the main portion of the agreement, for a 16 by 22 second-story addition for the sum of $3,500. Although the contract was silent with respect to the time or times when defendants were to make payments, it was understood that plaintiff would be paid periodically when defendants received money from their bank mortgagee under the terms of a building loan agreement. Three such payments were made totaling $7,400. The plaintiff commenced work on September 21, 1971 and ultimately "walked off” the job on January 13, 1972. During the period of about three and three-quarter months, periods of delay were occasioned by changes ordered by defendants, the installation of an extensive electrical system by. other workers hired by defendants and other work not to be performed by plaintiff but causing him to wait until such other work was completed before he could resume his duties. The plaintiff stopped work on January 13, 1972 when he learned that defendants’ mortgagees would not advance any further money until the second-story addition was constructed. The court found that plaintiff had substantially performed the terms of the contract and to the degree that he failed to fully perform, monetary credit was allowed to defendants against plaintiff’s demand for the balance of the contract price plus the costs of the "extras” agreed upon between the parties. Inherent in the conclusion of the court is the finding that plaintiff was not bound by defendants’ agreement with the bank that the advancement of money was conditioned on the construction of the second-story addition. We agree. It is a well-established general rule that substantial performance of a contract will support a recovery of the contract price, plus agreed-upon "extras”, less allowances for defects in performance or damages for failure to literally perform the agreement (Gem Drywall Corp. v Scialdo & Sons, 42 AD2d 1045, affd 35 NY2d 781). The doctrine of substantial performance necessarily includes compensation for defects and, herein, the court correctly allowed defendants a credit in the sum of $3,093.94 for materials not furnished and inconsequential delay against the contract price of $12,790 plus the reasonable value of the "extras” in the sum of $3,658.49. There is a preponderance of evidence in the record to justify the conclusion below that plaintiff essentially performed that which was required of him by the contract to the extent that defendants obtained substantially what they bargained for. The deviations and omissions were not based on "bad faith” but were occasioned by factors beyond the control of plaintiff and, where, as here, such departures from the agreement can be compensated for without doing material damage to the purpose of the agreement, it has been substantially performed. Next, since plaintiff was not a party to the building and loan agreement, he was justified in leaving the job, substantially performed at the time, when he was advised by an officer of the mortgagee that no more advances would be made to the homeowners. Implicit in the finding of substantial performance of the contract by plaintiff and the credits allowed defendants is the conclusion that the latter did not have to expend the sum demanded in their counterclaim to finish the work. The court found defendants’ proof in this regard lacking in the degree of preponderance requisite to recovery and, upon this record, we agree. Judgment affirmed, without costs. Sweeney, J. P., Kane, Mahoney, Larkin and Herlihy, JJ., concur.