3(2)If, before the parties were discharged, the party to whom the sums were paid or payable incurred expenses in connection with the performance of the contract, the court, if it considers it just to do so having regard to all the circumstances, may allow him to retain or to recover, as the case may be, the whole or any part of the sums paid or payable not exceeding the amount of the expenses, and without restricting the generality of the foregoing the court, in estimating the amount of the expenses may include such sum as appears to be reasonable in respect of overhead expenses and in respect of any work or services performed personally by the party incurring the expenses.