delivered the opinion of the court.
This was an action commenced on the part of lien claimants to foreclose mechanics ’ liens on real property situate in the city of Denver. Such proceedings were had that other lien claimants and the trustees under deeds of trust on the property and their beneficiaries were made parties. The trial court adjusted the several liens thus represented in rank and amount. From this judgment the trustees and their beneficiaries appealed.
There is no controversy between the mechanics ’ lien claimants. The appellants claiming rights under the deeds of trust, however, attack their claims, and complain of the judgment in so far as it subordinates their rights to these liens,, and also complain of the adjustment of the several liens claimed under the deeds of trust as between themselves. The important questions to determine are (1) the relative rank of the liens represented by the respective deeds of trust; (2) the rank of such liens with respect to the several mechanics ’ liens; (3) the validity, amount and other questions directly affecting the latter liens.
At the inception of the transactions out of which this litigation arose, the lots upon which a building was afterwards erected stood in the name of Ida B. Snell, subject to a first encumbrance securing the sum of $2,000, and also a second deed of trust representing in part the purchase money for such lots. The note secured by the latter encumbrance belonged to the appellant, Mrs. 0 ’Donnell. At this time a mutual agreement was entered into between Mrs. Snell, Mrs. O’Donnell, and the appellants, Tooker and Joralmon, *30whereby Tooker loaned Mrs. Snell $7,500, and Joralmon loaned her $500, to be applied as follows: $2,000 to discharge the first encumbrance, and the remainder in the construction of a building on the lots, in consideration of which Mrs. O’Donnell released her encumbrance; Mrs. Snell executed a trust deed for the.benefit of Tooker, and another in favor of Joralmon, which were placed of record in the order named, and a third deed of trust for the benefit of Mrs. O’Donnell, subject to the other two, in the sum of $4,000, which was recorded as a third encumbrance. Joralmon & Company, who were the representatives of appellants Tooker and Joralmon, then entered into a building contract with Mrs. Snell for the erection of a building upon the lots in question. ' Under this contract the building was constructed. The indebtedness incurred in its erection not having all been paid, those claiming liens on account of labor performed and materials furnished for its construction, filed liens, and later commenced an action to foreclose. On the trial the court found as a fact that of the $8,000 represented by the deeds of trust executed for the benefit of Tooker and Joralmon, $2,000 had been advanced to discharge the first encumbrance, and $2,-770.10 in paying workmen engaged in the construction of the building and for materials furnished for that purpose. We understand that the rights growing out of the Tooker and Joralmon deeds of trust have, in effect, been pooled. The beneficiaries under these encumbrances claim to have made other advances on account of their engagement with Mrs. Snell, to which they are entitled to credit, but over and above the $4,770.10 applied as above indicated, none of these advances or any sum which may be due them on account of the notes represented by the deeds of trust were applied to the betterment of the property. The rank of the several liens of the respective beneficiaries un*31der the deeds of trust as between each other was not provided for in detail, and we must therefore determine the intention and rights of the parties in this respect from the results which would follow the execution of their contract under which these deeds of trust were given. Originally, Mrs. O’Donnell’s lien was subject only to the prior encumbrance of $2,000. The consideration which moved her to postpone this lien to prior encumbrances aggregating $8,000 was twofold: (1) that a prior encumbrance of $2,000 should be discharged, and (2) that the remainder should be expended in improvements on the property. By carrying out this arrangement, the value of the property pledged for the payment of her indebtedness would be enhanced, so that while it was encumbered for a greater amount than before, the discharge of the first encumbrance and its improved condition gave her a greater value to which the lien of her deed of trust would attach. Tooker and Joralmon had agreed with Mrs. O ’Donnell that the money secured by their deeds of trust should be applied in a manner which would bring about this result, and their rights as against hers would, therefore, be limited accordingly. To accomplish this end they had agreed with Mrs. O ’Donnell to apply the advances secured by their deeds of trust to two objects: (1) to the discharge of the first encumbrance of $2,000; and (2) to the improvement of the property. In each instance, however, their liens would be limited as against her rights to the extent the value of her lien was increased, because, under their agreement with her, that would be the result of an application of the funds secured by their deeds of trust. They have discharged the first encumbrance, and are, therefore, entitled to a first lien upon the lots for this sum, because to that extent Mrs. O’Donnell has been benefited. Subsequent advances for the purposes contemplated by the agreement *32would not change or enlarge this lien. They were to apply the remainder in constructing a building. For this purpose they have advanced $2,770.10. For this ■sum they are also entitled to a lien upon the lots and buildings in advance of Mrs. O’Donnell’s, because to-that extent the value of her lien has been increased, but this lien upon the building is limited to this sum, because it is all that has been advanced for the purpose of constructing it. Whatever other sums the parties primarily liable for the indebtedness secured by the Tooker and Joralmon deeds of trust may owe the beneficiaries under these encumbrances, and which may be a lien upon both lots and building, would be subject to the lien of Mrs. O’Donnell, because not applied in the manner provided for in the contract under which these several deeds of trust were executed. The lien under the Tooker and Joralmon deeds of trust as against Mrs. O’Donnell would, therefore, be limited (1) to $2,000 upon the lots; (2) to $2,770.10 upon the lots and building, which would, in effect, be a first lien in their favor for $4,770.10 upon the lots, $2,770.10 of which would be a first lien upon the building. Mrs. O’Donnell’s lien would attach to the land, subject to the first lien under the Tooker and Joralmon deeds of trust, in the sum of $2,000, and to a lien in favor of these parties upon both lots and building in the sum of $2,770.10. The remaining amount due the beneficiaries under the Tooker and Joralmon deeds of trust would attach to both lots and building, subject to all of the foregoing liens.
The next question presented is the relative rank between the liens secured by the respective deeds of trust and those claimed by the mechanics’ lien claimants. That the lien of Mrs. O’Donnell upon the lots is superior to the mechanics’ lien claimants is apparent from the statute — sec. 2885, 3 Mills’ Ann. Stats.— which provides that mechanics’ liens shall not impair *33any valid encumbrances npon tbe land npon which improvements are erected, and on account of which liens are claimed, which are recorded prior to the execution of the building contract or the commencement of work upon the structure. The deed of trust securing Mrs. O’Donnell was executed and recorded before the building contract was entered into between Joralmon & Company and Mrs Snell, or the commencement of work, and is, therefore, fully protected as fi> the lots by the statute in question; but in the circumstances of this case her mortgage, by virtue of sec. 2884, would only attach to the improvements subject to the rights of the lien claimants.
The Tooker and Joralmon deeds of trust were also executed and recorded before the building contract was entered into, and before the work was commenced. That these deeds of trust should have preference over the lien claimants in so far as the lots are concerned up to the amount of the indebtedness actually owing on the notes secured thereby, is also apparent from the provisions of sec. 2885, supra. It specially provides that the right of lien shall not impair any valid encumbrance upon the land on which a building is constructed, which is recorded prior to the signing of a contract for the erection of such building, or the commencement of work thereon. In other words, the right to a lien cannot be construed to impair a valid contract creating a lien upon land which is recorded prior to the time when the right to a lien of the mechanic would attach.
The vital question is the relative rights of the mechanics ’ lien claimants and the beneficiaries under the Tooker and Joralmon deeds of trust to a lien upon the improvements. Sec. 2884,'3 Mills’ Ann. Stats., provides that mechanics ’ liens shall attach to a. building in preference to any prior mortgage upon the land on which the same is erected. Under this section the *34•lien claimants-contend that their rights to a lien upon the building are superior to those of the beneficiaries under the Tooker and Joralmon deeds of trust.
The sections we have cited were enacted for the protection of those engaged in the erection of, or furnishing materials for, a building, but they were not intended to, and cannot, secure them the rights therein mentioned- under any and all circumstances. In the first it is only contemplated that the mechanic’s lien shall attach to an improvement in preference to a prior mortgage on the land upon which such improvement is erected, where such mortgage is given in the usual way without intent that it shall cover improvements, and. where the lien claimants have no notice that it is intended' to be more than a mortgage upon the land itself. By the terms of the second, the lien of the mechanic attaches from the time of the commencement of work upon the structure on account of which a lien is claimed. All liens existing prior to that date of which he has notice are superior to his, except as specially 'modified by statute, and except as thus modified his rights are dependent upon the law of notice and contract the same as any other litigant. These statutory provisions must be construed in connection with the rules of law which ordinarily fix the rights of parties, and are applicable to any given transaction under consideration. They are not so ironclad that their provisions may not he waived or modified by the conduct of the parties. The Tooker deed of trust was recorded before the building contract was entered into or work commenced upon the building. It included a brick dwelling upon the premises described. No such building was in existence at the time, hut the recording of the mortgage was constructive notice to all of the existence of that encumbrance. The • express understanding between Mrs. Snell and Joralmon & Company as the representa*35tives of those who had agreed to loan Mrs. Snell money, was to the effect that advances made would be used in erecting a building. The lien claimants all had notice of this arrangement; knew that money was being advanced under the mortgage for the express purpose of being applied upon their claims, and as a matter of fact many of them received the money over the counter of Joralmon & Company.- To the extent of $2,770.10 the money thus advanced was applied to the betterment of the property. The lien claimants knew that it was the intention of the parties that the deeds of trust under which these advances were made should he a first lien upon the building. They engaged in the work of constructing this building and furnishing material in the full light of these facts. They have received the benefits of these advances, either in the way of money actually paid or in the- reduction or discharge of other claims which would have been- a lien upon the property, except for these advances. They have not been misled or deceived. Where mechanics and materialmen have notice of the existence of a mortgage which is given expressly for the purpose of securing funds to construct an improvement and know that the funds thus obtained are being applied in that way, their rights must be held subordinate to that of the mortgagee to the extent of such advances, because of this knowledge. In other words, when they know that a structure upon which they are engaged has been pledged as security for advances to be applied towards its construction by a contract entered into before the work of erection was commenced, they are bound by such an arrangement up to the extent that funds under such contract are actually advanced and applied to' construct the building. James River L. Co. v. Danner, 3 N. Dak. 470; Kiene v. Hodge, 90 Iowa 212; Hoagland v. Lowe, 39 Neb. 397; Patrick Land Co. v. Leavenworth, 42 *36Neb. 715; Anglo-American S. & M. Co. v. Campbell, 43 L. R. A. 622.
From these views it follows that as between the beneficiaries under the deeds of trust and the lien claimants, the amount due the former is a first lien upon the lots; that to the extent money was advanced unde'r the Tooker and Joralmon deeds of trust which was actually applied to the payment of labor performed and materials used in its construction, they are entitled to a first lien upon the building; and that the lien of Mrs. O’Donnell upon the building is subject to those of the mechanics ’ lien claimants.
The constitutionality of the lien act of 1893, under which the rights of the parties to this litigation must be determined, has been attacked. The particular objection urged against its validity is the provisions of sections 1 and 2 of the act. Without attempting to notice the provisions of these sections in detail, it is sufficient to say that none of them are involved in this case. The rights of the parties are in no manner dependent upon the construction or the validity of those matters objected to, and as it appears to us that the remainder of the act, notwithstanding these alleged objectionable features, may stand, and there is still sufficient to entitle the lien claimants to liens in this case, it is not necessary to pass upon the validity of the particular sections atttacked.
A further objection to the act is urged upon the ground that a mortgagee has the right to insist that land upon which he has taken a mortgage prior to the commencement of the construction of a building shall not be damaged by its subsequent removal, which would be the result even though he might not be entitled to a lien upon the improvements. The provision of the statute on this subject might also he set aside, and still .the act would be sufficient to sustain the lien, but, inasmuch as it clearly appears that it *37would be injurious to tbe interests of tbe parties concerned to permit any sale of tbe premises which would allow the purchaser of the improvements to remove them, the validity of the provision of the act attacked is not involved.
In the original briefs filed a great number of objections to the mechanics’ lien were argued. These are noticed in detail in the original opinion. On a reconsideration we are satisfied they are so manifestly without merit that we shall not attempt to determine them, but shall practically limit a discussion of these matters to those questions bearing on them which have been urged upon our attention on petition for rehearing.
It is claimed the evidence does not establish that the materials furnished by MePhee & McGinnity up to the full amount of their claim actually were used in the construction'of the building. We do not think this objection is well founded. It appears that the party purchasing for the building, and who, in fact, was responsible primarily for the indebtedness incurred in its erection, acknowledged that these materials were wrought into the structure, and that is certainly sufficient to make a prima facie case in favor of these lien claimants.
The claim of Suess Brothers is objected to by appellants because of the insufficiency of the lien statement. It undertakes to set out two contracts, one written and the other verbal. The written is stated haec verba. The particular objection urged against the statement is, that it does not specify what amount is due and owing under the written contract. In the opinion of the majority of the court, this objection is well taken. In the opinion of the writer it is not; but as the question upon which we disagree is wholly one of construction of the language employed in the statement, it can serve no useful purpose to discuss it. *38The judgment as to this claim will be modified so as to conform to the views of the majority, but this modification will only affect the rights of the appellants, because the mechanics’ lien claimants do not object to this claim.
It appears, from a comparison of the lien statement upon which the Doss Brothers’ claim is based, with the decree, that the amount awarded them is greater than the sum due, according to their statement. The decree should be corrected in this respect.
It is also urged upon our attention that during the construction of the building work ceased for more than thirty days, and the provisions of sec. 2876, 3 Mills’ Ann. Stats., are invoked, which provides, in substance, that the cessation of labor for thirty days upon any unfinished building shall be deemed equivalent to a completion thereof for all the purposes of the chapter relating to liens. We are of the opinion that the finding of the court, which was to the effect that labor had not ceased as contended, is sufficiently sustained by the testimony on this subject. Labor performed before a building is completed, which is in furtherance of its completion, whatever its character, does not come within the provisions of the statute on the subject.
It is also contended by counsel on behalf of the beneficiaries under the Tooker and Joralmon deeds of trust that by their pleadings they are not seeking to foreclose their lien, and that no judgment should be rendered which, in effect, compels them to accept the results of a foreclosure. Were it not for the fact that their liens are of different priority as compared with others, this claim would have merit. The lien of Mrs. 0 ’Donnell and the lien claimants can only be satisfied by a sale of the property to which the liens of the beneficiaries under the deeds of trust in question also attach, and in order that the rights of all *39may be fully protected, that course must be pursued which will insure such protection. While the mechanics ’ lien law is statutory, it is also equitable in'its nature, and rights under it, or associated with them, must yield to the power of a court of equity to decree that which is necessary to protect the rights of all interested. — Phillips’ Mechanics’ Liens, § 257.
It follows from the views expressed, that the judgment of the trial court must be modified. We shall not attempt to designate in detail the decree which should be rendered, because that can be better performed by the trial court, with the aid of counsel. We, therefore, remand the cause, with directions to modify the decree so as to conform with the views herein expressed, bearing in mind that it is not disturbed except in so far as it is not in harmony with this opinion.
The several claimants were allowed interest upon their claims,- and in entering a modified decree, that allowance should again.be made.
The only remaining question relates to the provisions of the decree relative to a sale of the premises. We have already indicated that it would be destructive to the interests of the parties to direct a sale which-would permit the purchaser to remove the improvements. Inasmuch, however, as the liens attach separately to improvements and the lots themselves, the proceeds must be divided accordingly. To this end we direct the court to ascertain the value of the improvements separate and apart from the lots, and also the value of such lots without the improvements. The property shall be sold in the manner provided by law as a whole. Such sale shall not take effect until approved by the court. The money realized from such sale shall be paid into the registry of the court, and after deducting costs, shall be apportioned to what shall be designated a building and lot fund, in *40the proportion which the value of the improvements and the lots, as found by the court, bear to each other. These funds shall be applied upon the respective claims in the order of priority they have been decreed liens upon the property from which such funds have been realized, as feed by this opinion. The building fund, after deducting therefrom the amount which must be applied upon the first lien thereon under the Tooker and Joralmon deeds of trust, shall be apportioned among the mechanics’ lien claimants in proportion to their respective claims, and in the order designated as between themselves in the original decree, provided that such remainder, up to the aggregate of the mechanics’ liens, less the amount which the Suess Brothers ’ claim has been reduced, as against the rights of appellants, shall be prorated among all the lien claimants, including the full amount' of the Suess Brothers ’ claim, as originally established by the trial court.
Cause remanded for modified decree.
Mr. Justice Steele dissents..