finishing the calculations