handling residual balance in the last installment