after stating the case as above, delivered the opinion of the court.
The office of a cross bill is either to warrant the grant of affirmative relief to the defendant in the original suit, to obtain a discovery in aid of the defense in that suit, to enable the defendant to interpose a more complete defense than that wMch he could present by answer, or to obtain full relief to all parties, and a complete determination of all controversies which arise out of the matters charged in the original bill. The fact that the cross hill fairly tends to accomplish either of these purposes is generally a sufficient ground for its interposition. It must seek equitable relief, but, subject to this qualification, a complainant who has brought a defendant into a court of equity in order to subject him to an adjudication of Ms rights in a certain subject-matter, cannot be heard to say that there is no equity in a cross bill which seeks an adjudication of all the rights of the parties to the original suit in the same subject-matter. The issues raised by the cross bill must be so.closely connected with the cause of action in the original suit that the cross suit is a mere auxiliary or dependency upon the original suit, but, subject to this qualification, new facts and new issues may properly be presented by a cross bill. Story, Eq. Pl. §§ 398, 399; 1 Beach, Mod. Eq. Prac. §§ 433, 435; Carnochan v. Christie, 11 Wheat. 446; Cross v. De Valle, 1 Wall. 5; Ayres v. Carver, 17 How. 591, 595; Meissner v. Buek, 28 Fed. 161, 163; Chicago, M. & St. P. Ry. Co. v. Third Nat. Bank, 134 U. S. 276, 10 Sup. Ct. 550; Davis v. Christian Union, 100 Ill. 313; Cartwright v. Clark, 4 Metc. (Mass.) 104; Derby v. Gage, 38 Ill. 27; French v. Griffin, 18 N. J. Eq. 279; Graham v. Berryman, 19 N. J. Eq. 29; Wickliffe v. Clay, 1 Dana, 585, 589; Allen v. Roll, 25 N. J. Eq. 164; King v. Insurance Co., 45 Ind. 43. Thus, in a suit to cancel deeds *264made to secure a debt, the defendant may maintain a cross bill to reform the deeds, and to foreclose the mortgage which they evidencé. Carnochan v. Christie, 11 Wheat. 446, 466. If an original bill is filed for specific performance of a contract, the defendant may properly exhibit a cross bill for the surrender and cancellation of the agreement. Cross v. De Valle, 1 Wall. 5, 14; Meissner v. Buek, 28 Fed. 161, 163. "Where a suit in equity is instituted to vacate or set aside a lien upon property by judgment, mortgage, or otherwise, the defendant may maintain a cross bill to establish and foreclose the lien. Railroad Cos. v. Chamberlain, 6 Wall. 748; Chicago, M. & St. P. Ry. Co. v. Third Nat. Bank, 134 U. S. 276, 287, 288, 10 Sup. Ct. 550. The converse of this proposition is equally true. When an original suit is brought to establish and foreclose a lien upon the property of the defendant, he may properly exhibit a cross bill in that suit for the avoidance of the lien, and the cancellation and discharge of the record of it which clouds his title. Graham v. Berryman, 19 N. J. Eq. 29; Wickliffe v. Clay, 1 Dana, 589. This is the case which this record presents. The appellee filed in the proper public office a claim of a lien upon the property of the appellant for more than $5,000, on account of materials it had furnished and services it had rendered in remodeling the appellant’s mill, pursuant to a contract between the parties. It then brought this suit to establish and foreclose that lien. The appellant exhibited its cross bill in that suit for the cancellation of that lien and its discharge of record. The allegation of the existence of the mechanic’s lien and the prayer for its foreclosure constitute the only ground for equitable relief presented by the original bill. The allegations of the cross bill that the debt claimed in the recorded statement of the lien did not exist; that the appellee was a nonresident of the state of Missouri, and without the jurisdiction of the court; that it had so failed to fulfill the guaranties of its contract that the mill it remodeled was worth $10,000 less than it would have been if the contract had been complied with; that the appellee had wasted wheat of the appellant worth $2,000 in useless experiments with its plansifters, and had racked and weakened the walls of the mill, — together with its prayer that the pretended lien might be canceled and discharged of record, certainly presented equities much stronger than those exhibited by the original bill, and brought the cross bill within the established precincts of equity jurisdiction. The owner of 'property may always maintain a suit in equity to clear the record of its title of invalid liens that apparently cover it, and there is much stronger reason for permitting him to ."o so by a cross bill when the holder of the pretended lien has sued him to enforce it. It is idle to argue that this appellant had an adequate remedy at law for the wrongs it pleads in the cross bill. It could obtain no decree of cancellation of the lien upon its property at law. It could not even maintain an action at law until it followed the appellee beyond the jurisdiction of the court of its residence into the state of Illinois. Does equity require a defendant who has a defense, counterclaim, or set-off to pay a debt secured by a lien upon its property to sit quietly by and see the lien foreclosed and his property sold because he can enforce his claim against the complainant in an action at law in an*265other jurisdiction? The remedy at law which precludes relief in equity must be “as practical and efficient to the ends of justice and its prompt administration as the remedy in equity.” Boyce’s Ex’rs v. Grundy, 3 Pet. 210, 215; Oelrichs v. Spain, 15 Wall. 211, 228; Preteca v. Land-Grant Co., 4 U. S. App. 326, 330, 1 C. C. A. 607, 610, 50 Fed. 674, 676; Foltz v. Railway Co., 19 U. S. App. 576, 8 C. C. A. 635, 641, 60 Fed. 316; Hayden v. Thompson, 36 U. S. App. 361, 17 C. C. A. 592, 594, 71 Fed. 60, 63. Would an action at law against the appellee in the state of Illinois, in addition to the suit in equity brought by the appellee in the statu of Missouri, be as practical and efficient for the prompt administration of justice between these parties as the presentation and adjudication of all (he controversies between them growing out of the contract in the single suit which the appellee brought in Missouri? These questions are susceptible of but one answer.
It is urged that the only claims presented by the cross bill that were not pleaded in the answer of the appellant to the original bill were (hose for the waste of the wheat and the injury to the walls of the mill; that these, could not be considered in equity, and hence the cross bill was properly dismissed. The answer is: (1) The cross bill repleaded the defenses in the answer and prayed for affirmative rel ief, — the cancellation of the record of the lien. Those defenses, if sustained, warranted that relief, regardless1 of the claims for damages for the waste of the wheat and for injury to the walls of the mill, and a cross bill which warrants affirmative relief upon the same facts pleaded as a defense in the answer to the original bill is well founded. (2) The statutes o'f the state of Missouri provide that in any civil action, whether at law or in equity, a defendant may plead and prove as a counterclaim any cause of action, whether legal or equitable, which arises out of the contract or transaction set forth in the petition as the foundation of the plaintiff’s claim. Rev. St. Mo. 1889, p. 542, § 2050. Under this provision of the statutes, a counterclaim for damage's for injury to property in the performance of services may be maintained in an action for their price.or value. Emery v. Railway Co., 77 Mo. 339, 346. If the appellee had brought this suit in one of the state courts of Missouri, the appellant’s claim for wash'd wheat and damage to the Avails of its mill could have been pleaded and proved as a counterclaim. One of the grounds of jurisdiction in equity is the prevention of a multiplicity of suits. The court below, sitting in equity, had taken jurisdiction of the parties and of the subject-matter of this action for a necessary purpose, — for the purpose of determining the validity of the lien claimed, arid of enforcing or canceling it. 29b reason occurs to us why that court could not have heard and determined the appellant’s claims for wasted wheat and for injured Avails as well as any court of law in the state of Illinois. It was not necessary to a just determination of those claims to compel the appellant, who had been summoned into thal court to answer the claim of the appellee for the performance of (his contract, to commence and prosecute an action at law in the shite of Illinois to recover its damages for1 the incomplete or negligent fulfillment of (lie terms of the same contract. It is the *266province and the duty of a court, of equity, which has properly acquired jurisdiction of a subject-matter for a necessary purpose, to proceed and do final and complete justice between the parties, where it can as well be done in that court as by proceedings at law. Tayloe v. Insurance Co., 9 How. 390, 404; Illinois Trust & Savings Bank v. Arkansas City, 40 U. S. App. 257, 22 C. C. A. 171, 76 Fed. 271, 288. The cross bill, therefore, should not have been dismissed without a hearing of the issues it presented, and the claims pleaded in it should have been considered and decided upon their merits. It prayed for affirmative equitable relief that rvas warranted by its allegations, and it enabled the court to grant full relief to all the parties to the original suit, and to completely determine all the controversies which arose out of the matters charged in the original bill, while this could not have been done upon a hearing of the issues presented by the answer.
Upon the merits of the case, the record discloses the fact that the appellant has received and retained substantial benefits from the performance of the contract in suit, but that the appellee has failed, at least in some particulars, to comply with the terms of the contract. The master and the court below found that the appellant had been damaged in the sum of $80 by the defaults of the appellee, but they made no finding upon or decision of the issues presented by the claims of the appellant in the cross bill for the wasted wheat and the injury to the walls of the mill. The evidence of both parties, however, upon these issues, was taken and submitted to the master and to the circuit court, and has been certified to this court. In this state of the case, the only question remaining is, what amount of damages has the appellant, sustained by the failure of the appellee to comply with the terms of the contract? An action upon a contract of sale, for the purchase price, may be maintained by one who has substantially, but not completely, performed it, if the purchaser has retained the benefits of that performance. The amount of the recovery, however, will be measured by the contract price, less the damages sustained by the defendant from the failure of the plaintiff to complete its performance in the agreed time and manner. German Savings Inst. v. De La Vergne Refrigerating Mach. Co., 36 U. S. App. 184, 17 C. C. A. 34, 38, 70 Fed. 146; Hammond v. Buckmaster, 22 Vt. 375; Dodsworth v. Iron Works, 31 U. S. App. 292, 13 C. C. A. 552, 557, 66 Fed. 483; Andrews v. Hensler, 6 Wall. 254, 258; Howard v. Hayes, 47 N. Y. Super. Ct. 89, 103. Compensation for pecuniary loss that is the direct, natural, and immediate consequence of a breach of a contract of sale, or of a guaranty contained in such a' contract, is the just and legal measure of a purchaser’s damages. The damages recoverable of a manufacturer for the breach of a contract to furnish machinery, or for a breach of a warranty of its character or serviceableness, where he has agreed to furnish and place suitable machinery in operation for a known purpose, are not confined to the difference between the value of the machinery as warranted and as it proved to be, but include such consequential damages as are the direct, immediate, and probable result of the breach. Accumulator Co. v. Dubuque St. Ry. Co., 27 U. S. App. 364, 379, 12 *267C. C. A. 37, 46, 64 Fed. 70, 79; 3 Pars. Cont. (7th Ed.) p. 212; 2 Suth. Dam. § 672; Mining Syndicate v. Fraser, 130 U. S. 611, 622, 9 Sup. Ct. 665; Poland v. Miller, 95 Ind. 387; Sinker v. Kidder, 128 Ind. 528, 530, 24 N. E. 341; Swain v. Scheiffelin, 134 N. Y. 471, 31 N. E. 1025; Passinger v. Thorburn, 34 N. Y. 634; Ferris v. Comstock, 33 Conn. 513.
Guided by these rules, we have endeavored to ascertain the amount of damages to which the appellant is entitled on account of all the claims it presents in its answer and cross bill, and Oras to put an end to this litigation. It has been a delicate and difficult task, — one. that’has entailed upon the court a careful and patient examination of all the evidence in the record; but the ends of justice and the interests of the parties seem to demand that their rights shall be finally determined, rather than that: they should be subjected to the delay and expense of another hearing. The testimony is voluminous. On. many important issues it is conflicting and evenly balanced, but there are a few salient facts established to a demonstration, and on these we rest our conclusions. The appellee undertook to remodel the mill of the appellant; to take out the reels which bolted its flour; to substitute its new machines, the plansifters, for these reels; to put in other machinery; to set all this machinery up and put it in operation, and with it to cause the mill to make 200 barrels of flour of certain standard grades in 24 hours. It knew, or ought to have known, the strength of the wails of the mill, the capacity of its plait sifters, their weight, and the effect of their operation upon the walls of this building. If their weight and vibratory motion shook and shattered some parts of those Avails, as the evidence tends to show they did, the appellee should kaA'e known that they would do so, and that the walls must be strengthened before it declared that the plansifters were suitable for use in this mill. It knew, or ought to have known, that any unnecessary delay in fulfilling the terms of the contract after the operation of the mill was stopped to permit the changes to be made must entail heavy losses upon the appellant. Ft knew, or ought to have knoAvn, that the production of flour of grades inferior to those guarantied, and in smaller quantities per day than those warranted, during an experimental period of four months, must cause great damage to the appellant. Under these circumstances, the appellee took the reels out of the mill, and put in its new plan-sifters and the other machinery. It had the remodeled mill ready to operate, and it commenced to operate it, on February 23, 1893; but it did not complete the three days7 test which the contract provided should determine that it was completed until June 29, 1898. In fact, it did not complete the mill, and it did not claim in its bill that it had completed its contract so that it was entitled to the money or the notes due to it upon its completion, until the 29tb day of June, 1893. During all this time the mill had failed to fulfill Use guaranties of the contract. Meanwhile the wheat of the appellant was ground into inferior flour, and a part, of its value was lost, and the capacity of the mill, instead of reaching the guarantied 200 barrels, varied from 145 to 175 barrels in 24 hours. The testimony that this failure was due to the fact that some of the old rolls in the mill *268were not true, and would not properly crush the wheat, is not persuasive, (1) because the testimony is full and uncontradicted that the same rolls properly crushed the wheat and made flour of the proper grades when the old reels were in use, before the plansifters were introduced; and (2) because, after four sets of these reels had been taken out at the request of the appellee, made true, and replaced in the mill, on March 11, 1893, it took out all its plansifters, substituted larger ones, and put in a reel to increase the capacity and service of the mill. This was a convincing confession by the appellee of a mistake and a default in the performance of its undertakings. The fact has not been overlooked that the contract contains this provision:
“It is hereby agreed that said party of the first part is to use its best endeavors to have said articles ready for shipment at the time stated herein, and also they shall he of the stated quality; hut it is not to he held liable for any pecuniary damages in either case, except to make good any unmerchantable defect which may be proved to exist in such articles when furnished, or be held for any damages incident to delay in starting up.”
But this clause of the agreement could not relieve the appellee from the consequences of unreasonable delay, or a breach of the guaranties contained in the contract, after the machinery had been shipped, after it had been set up in the mill, and after the remod-. eled mill had been put into operation. This contract contained another stipulation to the effect that if the appellee failed to make its machines produce the guarantied results after a fair trial, it would remove them and replace the reels. A reasonable time — perhaps two weeks — might well be allowed to the appellee, after the mill was started, to get the machinery in perfect running order; but it is plain that the parties to this contract never intended to release the appellee from all damages for a breach of the contract, or of the guaranties which it contained, which continued for months after the machinery was in operation. The established facts to which we have adverted have forced us to the conclusion that in the time and manner of performing its contract the appellee made substantial failures. It would be an idle task, to review the evidence on the various claims of deficiencies and defaults presented by the answer and the cross bill in this case. It is sufficient to say that in our opinion the record fairly shows that the appellant suffered damages, which were directly caused by the failure of the appellee to fulfill the terms of its contract, in the sum of $2,000 more than was allowed to it by the master and the court below. Moreover, the $500 for the attorney’s fees of the appellee should not have been allowed to it in the decree, because the appellant offered before the suit was commenced to pay the claim of the appellee, less a reduction of the $2,000 to which we have found it was entitled. The decree on the bill and cross bill must be reversed, with costs, and the cage must be remanded to the court below, which should enter a decree, without further hearing, upon both bills, to the effect that the appellee recover judgment of the appellant for the sum of $2,886.39, with interest from August 1,. 1893, that the appellee is not entitled to $500 as an attorney's fee, and that the costs in that court be taxed and paid and the executions be issued as directed in the original decree. It is so ordered.