Section 15. Where the injury for which compensation is payable was caused under circumstances creating a legal liability in some person other than the insured to pay damages in respect thereof, the employee shall be entitled, without election, to the compensation and other benefits provided under this chapter. Either the employee or insurer may proceed to enforce the liability of such person, but the insurer may not do so unless compensation has been paid in accordance with sections seven, eight, ten A, eleven C, twelve or nineteen nor until seven months following the date of such injury. The sum recovered shall be for the benefit of the insurer, unless such sum is greater than that paid by it to the employee, in which event the excess shall be retained by or paid to the employee. For the purposes of this section, “excess” shall mean the amount by which the gross sum received in payment for the injury exceeds the compensation paid under this chapter. The party which brings the actions or which pays the costs associated with the action, if the party bringing the action does not pay those costs, shall be entitled to retain those costs recovered in the action. Any interest received in such action shall be apportioned between the insurer and the employee in proportion to the amounts received by them respectively, exclusive of interest and costs. The expenses of attorney’s fees shall be divided between the insurer and the employee in proportion to the amounts received by them respectively, under this section. Except in the case of settlement by agreement by the parties to, and during a trial of, such an action at law, no settlement by agreement shall be made with such other person without the approval of either the board, the reviewing board, or the court in which the action has been commenced after a hearing in which both the employee and the insurer have had an opportunity to be heard. At such hearing the court shall inquire and make a finding as to the taking of evidence on the merits of the settlement, on the fair allocation of amounts payable to the employee and the employee’s spouse, children, parents and any other member of the employee’s family or next of kin who may have claims arising from the injury for which are payable, under this chapter in which the action has been commenced after an opportunity has been afforded both the insurer and the employee to be heard on the merits of the settlement and on the amount, if any, to which the insurer is entitled out of such settlement by way of reimbursement, and on the amount of excess that shall be subject to offset against any future payment of benefits under this chapter by the insurer, which amount shall be determined at the time of such approval. In determining the amount of “excess” that shall be subject to offset against any future compensation payment the board, the reviewing board, or the court in which the action has been commenced shall consider the fair allocation of amounts payable to and amongst family members who may have claims arising from the injury for which said compensation is payable. In the case of a settlement by agreement by the parties to and during a trial of such an action at law, only the justice presiding at the trial shall have and exercise, relative to the approval of such settlement by agreement and to the protection of the rights and interests of the employee, his family members, and the insurer, the powers granted in the preceding sentence. Nothing in this section, or in section eighteen or twenty-four shall be construed to bar an action at law for damages for personal injuries or wrongful death by an employee against any person other than the insured person employing such employee and liable for payment of the compensation provided by this chapter for the employee’s personal injury or wrongful death and said insured person’s employees. For purposes of this section, the Workers’ Compensation Trust Fund, as established under subsection (2) of section sixty-five, shall be deemed an insurer.