Exception 1. The entire indebtedness incurred by the defendant is found to amount to $2,587.71, and the partial payment to $1,864.88, showing a balance due the plaintiff on December 15th, 1886, of $722.83, for which sum (again reduced by five dollars) the defendant Houston gave a certificate in these terms :
“ This is to certify that I am indebted to C H. Lester in the sum of seven hundred and seventeen dollars and eighty-three cents, balance due for building house at Davidson College. This 15th day of December, 1886.
G. S. HOUSTON.”
On this accounting all the materials were found to have been paid for in the credits.
*609In this adjustment all the charges preferred were admitted to be correct, and the defendant not designating before, or then, how the payments should be applied to the residue of the debt outside of that incurred for materials, left the creditor to apply them, even if not by law so appropriated, to the items, if any, not secured by a lien; and this confines the sum demanded in the action'to the unpaid charges for labor performed upon the premises, and thus eliminates from the controversy such as are resisted as not entitled to the lien. The creditor may, and if he does not the law will, apply the money paid without direction to the most precarious debt. Ramsour v. Thomas, 10 Ired., 165; Moss v. Adams, 4 Ired. Eq., 42; Jenkins v. Beal, 70 N. C., 440; Sprinkle v. Martin, 72 N. C., 92.
If the payments were upon a running account the credits would be appropriated as made to the preceding charges, to-wit: the first item of the debit side discharged by the first item on the credit side. Jenkins v. Smith, 72 N. C., 296. The same general ruling is made in Boyden v. Bank, 65 N. C., 13; modified, however, in the case of a transition from one to another currency which are of different values.
This brings us to the consideration of the proposition contended for by defendants, which interprets the statute (The Code, § 1781) as giving the lien to mechanics and laborers as such, who themselves so work, and refuses it to contractors by whom they are employed and for whom they render service.
The Constitution requires the General Assembly to “provide by proper legislation for giving to mechanics and laborers an adequate lien on the subject-matter of their labor.” Art. 14, § 4. And the statute gives the lien “ for the payment of all debts contracted for work done on the same or material furnished.” The Code, § 1781. In the construction of this section it is declared, in Wilkie v. Bray, 71 N. C., 205. *610that “in order to create the lien, the circumstances must be such as first to create the relation of debtor and creditor; and then it is for the debt that he has the lien.”
The effect of this ruling, which makes the statutory lien an incident to and the offspring of the contract out of which the indebtedness springs, and confines it to the party to the contract, made at' June Term, 1874, was followed by the enactment of March 29, 1880, entitled “An act to give sub-contractors, laborers and material men a lien for their just dues,” the provisions of which constitute sections 1801, 1802 and 1803 of The Code in chapter 41.
It was not intended to supersede the lien of the contractor, for it in direct terms gives the lien in favor of sub-contractors^ laborers and material men a preference over “ the mechanics’ lien now provided by law,” and provides that when notice is given, the aggregate of such liens shall not- exceed the amount then due the original contractor.
The legislation is intended to extend the remedy to those who work or furnish materials from which the owner derives a benefit in the improvement of his property, even where there are no contract relations between them and the owner, and enable them to secure, in order to the payment of what is due them, the indebtedness due from the debtor to the contractor.
Whatever may be the ruling in other States in the construction of such a statute as may be there in force, it is quite manifest that ours gives to the contractor, under whom his employees and agents work, the lien provided in section 1781, and though subordinated to the lien of the latter, and only displaced when its enforcement would be prejudicial to them, when these are paid the contractor’s lien becomes absolute and unconditional. Such is the result of our legislation upon the subject, and similar views are taken by the authors, Phillips and Kneeland, who have written on the subject of Mechanics’ Liens.
*611Says the first named author, quoting from the opinion of the Court delivered in the case of Woodbury v. Grimes, 1 Cal., 100, in reference to a law whose terms are very like our own: “Now,a debt cannot be due except upon a contract,express or implied, and therefore the act assumes the existence of a contract, but does not create it.” Phill. Mech. Liens, sec. 28.
He defines the contractor as “ one who agrees to do anything for another,” and adds that “ this general term, however, as will be seen, has been held to include either those who have made contracts directly with the owner of the premises or those who have contracted with the contractors.”. Sec. 40. He thus describes a sub-contractor: “ One who has entered into a contract, express or implied, for the performance of an act with- the person who has already contracted for its performance.” Sec. 44. The other author uses language of similar import, and says: “ Although the original contractor may sub-let his entire contract, and neither himself performs labor or furnishes materials in a literal sense, yet he will be entitled to a lien, for each sub-contractor is an agent for the performance of a portion of the entire contract, and the act of the agent is in law the act of his principal.” Kneeland, Mech Liens, sec. 3.
Again, he defines sub-contractors, laborers and material men, and says they are all “ specially provided for in all the existing statutes of this State (New York), and it makes no difference in what degree they stand to the original contractor, provided the work or material was rendered specially for the building on which the lien is sought.” * :|i * *
“ Neither the owner, the contractor, nor any sub-contractor can be compelled by such proceeding to pay any third party a greater sum than that due to the person with whom he has contracted.” Sec. 4.
The case— Winder v. Caldwell, 14 Howard U. S., 438— cited for appellant, decided upon the words of a statute altogether *612different, is not applicable, and if it were, we are not disposed to follow it.
The filing of the claim and its specifications, in order to perfect the lien, seem to pursue the statutory requirements, and are not questioned by the appellant. As this lien has precedence of all other liens, incumbrances which attach to, the property subsequent to the time at which the work was commenced, it is superior to the title acquired under the deed to the defendant Brown, and must prevail over it, according to the statute. Section 1782, as construed m Burr v. Maultsby, 99 N. C., 263.
There is no error, and the judgment must be affirmed.