Better grouping of the calculations and more comments.