This bill in equity is before us on report. Three times before, problems arising out of the effort of Herbert F. Shaw to provide by his will for a public library for the Town of Mount Vernon, have been before this court. The first case was dismissed without a consideration of the merits. The issues raised by the others have been decided. Manufacturers National Bank, Executor, v. Woodward, 138 Me., 70, 21 A. (2d), 705; Manufacturers National Bank et al. v. Woodward, 140 Me., 117, 34 A. (2d), 471. The first of these latter two arose out of the declination by the town to act as trustee under the will, which gave the testator’s land and house with its contents to the town as trustee and the residue of the estate to the bank as trustee, both of which trusts were designed “to serve the common purpose of providing a public library in the town.” It was held that the trust would not be permitted to fail because of the refusal of the town to accept the trust. The case was remanded for a decree appointing new trustees. These were appointed and the second of these cases, repórted.in 140 Me. 117, 34 A. (2d), 471, was brought by these trustees and by the bank seeking a construction.óf the first clause of ..the will. The essential part.of this clause reads as follows:
*30“I give and bequeath to the Town of Mount Vernon; Maine, my house and lot, in Mount Vernon Village, for use as a public library, and whatever remains after other sums hereinafter to be named have been disposed of shall be kept as a permanent fund, the income of which shall be used in keeping the buildings in repair and purchasing suitable books for the library.”
The court was asked whether the will could be so interpreted as to permit the use of the income of the fund for the necessary expenses in equipping and operating the library. We held that no foundation was laid for such an interpretation, for the bill did not allege and there was no evidence that the trust would fail if such deviation was not permitted. Following the direction of this court the bill was dismissed but such dismissal was without prejudice to the right of the plaintiffs to bring another bill seeking relief on any proper equitable ground, either under the rule of cy pres or in accordance with the doctrine approved in Porter v. Porter, 138 Me., 1, 20 A. (2d), 465, that the mode of administering a trust may be deviated from where to do so is necessary to carry out the purpose of the creator of the trust.
The present bill, brought by the same parties, alleges that there is no money and no prospect of obtaining any for the running expenses of the library such as the payment for a janitor and librarian, for fire insurance and for heat and light, and that the trust will fail unless the trustees are permitted to use a part of the income of the fund for these purposes. The evidence sustains these allegations.
The contention of the defendant is that it will take so large a part of the income to pay for maintenance that there will not bé a sufficient amount left for the purchase of books and that the réal purpose of the testator will be defeated by such suggested modification of the terms of the will. We do not think that this result will follow. On the con*31trary we are of opinion that, if the primary requirement of maintenance is taken care of, money will be forthcoming for the purchase of suitable books. The basic contention of the defendant is that there can be no deviation from the express provisions of the will because this gift was not for a general charitable purpose, but rather was limited to a particular object, and must therefore be carried out strictly according to the terms as expressed by the testator.
In our opinion the primary intent of the testator was to establish a public library in the Town of Mount Vernon. The giving of his house and lot and the establishment of the trust fund were the means to carry out such purpose. Under such circumstances it is well settled that equity will apply the rule of cy pres to prevent a failure of such general charitable intent. Snow et al. v. The President and Trustees of Bowdoin College et als., 133 Me., 195, 175 A., 268, and cases therein cited. In applying such rule the court may be called upon, not only to deviate from the particular means which the testator has prescribed to carry out his wishes, but may apply the gift to a different object of a similar character. Jackson v. Phillips, 14 Allen, 539; Snow et al. v. The President and Trustees of Bowdoin College et als., supra, 200, and cases therein cited.
It necessarily follows that if the court may, to prevent a failure of a charitable trust, apply the gift to a different object of a similar character, it may modify the method prescribed by the testator for carrying out the specific object. It is doubtful if such procedure represents a true application of the rule of cy pres, for a deviation from the express terms of the grant is often permitted to prevent the failure of a trust which is not charitable. See Porter v. Porter, supra, and authorities therein cited. See the following authorities as illustrating the distinction between the use of the cy pres power of the court and the modification which equity sane-*32turns of the method designated by the creator of the trust for its administration. Dunn v. Ellisor, 225 Ala., 15, 141 So., 700; Shannon v. Eno, 120 Conn., 77, 179 A., 479; Crerar v. Williams, 145 Ill., 625, 34 N. E., 467, 21 L. R. A., 454; Webb v. Webb, 340 Ill., 407, 172 N. E., 730, 71 A. L. R., 404; National Bank of Greece v. Savarika, 167 Miss., 571, 148 So., 649; Lackland v. Walker, 151 Mo., 210, 52 S. W., 414; City of Philadelphia v. The Heirs of Stephen Girard, 45 Pa., 9, 84 A. M. Dec., 470; City of Providence v. Payne, 47 R. I., 444, 134 A., 276; Tincher v. Arnold, 147 Fed. 665, 7, L. R. A. N. S., 471, 8 Ann. Cas. 917; 11 C. J., 358; 14 C. J. S., p. 510, Sec. 50.
In Stevens v. Smith, 134 Me., 175 (183 A., 344) the court at page 178 quotes with approval the following language from the case of Lackland v. Walker, supra:
“ Tt is a natural and necessary branch of the jurisdiction over charitable trusts that the means or details prescribed for the administration of such a trust should be subject to be molded so as to meet any exigency which may be disclosed by a change of circumstances, and to relieve the trust from a condition which imperils or endangers the charity itself, or the funds provided for its endowment and maintenance.’ ”
The case of Tincher v. Arnold, supra, raises almost exactly the same question as is now before us. A testator devised and bequeathed the residue of his estate to trustees to manage and when a fund of a stated amount had been accumulated to erect a building to be used as a school for the purpose of educating boys between the ages of 12 and 18 years who were unable to educate themselves, and then directed that the remainder of the fund should be kept at interest and the net income. used “for ■ the purpose of paying teachers employed in said school” One of the questions before the court on a bill in equity brought by the heirs-at-law to have the *33residuary clause of the will held void was, to use the language of the court in its opinion, whether “the will imperatively requires all income to be used for teachers’ wages, leaving nothing for other things absolutely essential, such as heating, lighting, care of the schoolhouse, repairs, taxes, and board and clothing of the boys.” The court held that education was the dominant purpose of the charity and that to prevent the failure of that purpose the court would permit the use of a portion of the income for essential maintenance. The court said, page 673:
“The whole income cannot be applied, as literally directed, to teachers’ wages, since there can be no teaching without other things. To earn wages, or have education, or carry on the designated school, or make it in any degree successful, or even tolerable, there must be heat, and light, and paid labor. To mention education, a school, a building, and teachers, is to impliedly mention those things essential to their success, if not to their very existence. A literal, iron-bound construction makes the plan impossible, and defeats it. A liberal one saves it, through a mere change of detail, and thus gives effect to the testator’s worthy purpose. ‘Qui haeret in litera, haeret in cortice.’ ,
“A limited application of the equitable rule of cy pres or the so-called ‘doctrine of approximation,’ is relied on for permitting a change of plan, by which the income, restricted by the will to teachers’ wages, may be partly applied to other expenses necessarily preceding them. This is on the theory that the testator’s main purpose was education, and that he could not have intended to so limit and hamper the use of the money as to defeat the very object designed. This dominant purpose to found a school and furnish the means of education being clear, imperfect or impossible details of method may be cor*34rected, so long as the main object — education — is secured and preserved.”
In the case now before us it is the duty of the court, in accordance with these well recognized principles, to so vary the method prescribed for carrying out this trust that the underlying wish of the testator to provide a library for the Town of Mount Vernon may be fulfilled. To that end the case should be remanded to the sitting justice with directions to order that so much of the net income of the trust fund as is not necessary for the repair of the buildings and for the purchase of suitable books shall be used to pay for general maintenance of the buildings, such as heat, light, and insurance and also for the payment of the wages of a janitor and librarian. If at a later time conditions change so that it is advisable that the amounts allotted for these purposes shall be altered, the door of the court is open to any interested party to seek such modification of the method adopted as will carry out the benevolent purpose of the testator. Snow et al. v. The President and Trustees of Bowdoin College et al., supra.
Case remanded to sitting justice for a decree in accordance with this opinion. Costs and reasonable counsel fees to be fixed by the sitting justice, paid by the trustees and charged in their probate account.