Section 127F. If the court finds after hearing that the facts are as alleged in said petition, it may by written order authorize the petitioner or any other affected tenant to pay to the clerk of the court the fair value of the use and occupation of the premises, or such installments thereof from time to time as the court may direct; provided the court finds that any such violation may endanger or materially impair the health, safety or well-being of such tenant and that such payments are necessary to remedy the condition constituting the violation; and that said tenant is not in arrears in his rent, taking into account any abatement of rent due to the existence of such violations, or if he is in arrears is willing to pay any arrearage into the court as ordered. A person occupying the premises shall not be considered to be in arrears in his rent when the amount of rent the landlord alleges in good faith to be due is equal to or less than the amount of any counterclaim that said person may bring in good faith against the landlord, including any damages owed because of a breach of warranty or a violation of any other law. In determining said fair value, the court may be guided by any findings issued by the department or any other agency concerned with the condition of residential premises and any other evidence relative to the effect of violations of such standards upon the use and occupation of residential premises. Any order of the court shall be forthwith sent by the clerk of court to any and all mortgagees and lienors of record as the court deems proper under the circumstances.
The court may direct the clerk by written order to disburse all or any portion of the rental payments received by him to the respondent for the purpose of effectuating the removal of the violation. The court may also direct the clerk to make such other disbursements of the rental payments to the respondent or to any other person as in the judgment of the court will permit the owner to maintain the property.
When the violation is removed, the court shall direct that the balance of funds, if any, remaining with the clerk be paid to the respondent. The court may render judgment for costs in its discretion.
In lieu of or in addition to any relief that may be provided under this section, the court may appoint a receiver under section one hundred and twenty-seven I.