(a) whether the primary purpose of the special limitation, condition subsequent or agreement to convey, reconvey or surrender was to restrict the use of the land;
(b) whether the purpose of the restriction was to ensure that the substantial value of the land or of the estate subject to the special limitation, condition subsequent or agreement, rather than the land itself, or such estate itself, be devoted to and employed for a benevolent, charitable, educational, public or religious purpose. If the findings with respect to (a) and (b) are such as to make the following matters relevant or appropriate for consideration, the court shall also consider and make findings with respect to the following:
(c) whether the existence of the restriction is substantially impeding the owner of the land, or of the estate subject to the special limitation, condition subsequent or agreement, in the furtherance of the benevolent, charitable, educational, public or religious purposes for which the land is held;
(d) whether the person or persons who would have a right of entry, possessory estate resulting from the occurrence of a reverter, or right to conveyance, reconveyance or surrender of the land or estate in the event of breach of the restriction at the time of the action will suffer substantial damage by reason of extinguishment or modification of the restriction, and, in such event, whether damages or restitution of the land, or its value, in whole or in part, should be awarded to such person or persons. 4. The judgment of the court may include, in the discretion of the court, an adjudication (a) that the restriction is discharged in whole or in part, or that its tenor is modified as provided in the judgment; (b) that the holder of the land or estate therein subject to the restriction be authorized or directed to convey, lease, mortgage or otherwise dispose of the land or estate therein free of the restriction and that the purchaser under such disposition shall take free of the restriction; (c) directing the use to which the avails of any such disposition shall be put; (d) declaring the interests that the owners of the possibility of reverter or right of entry, or persons having an interest pursuant to the agreement, shall have in any property paid for in whole or in part with the proceeds of the disposition; (e) awarding damages for such injury as a party to the action may sustain by reason of extinguishment or modification of the restriction. The judgment may include such other provisions as will in the opinion of the court further the benevolent, charitable, educational, public or religious purposes for which the land is held and such other provisions as equity may require. 5. This section shall apply to a special limitation or condition subsequent created or agreement made either before or after September 1, 1958, except that it shall not apply (a) where a right of entry or right to a conveyance, reconveyance or surrender of the property has accrued or a reverter has occurred prior to that date, or (b) where the conveyance creating the restriction was made by or the agreement creating the restriction was made with the United States, the state of New York or any governmental unit, subdivision or agency of the United States or the state of New York.