Adding my comments so I can see what code will have to be written to carry out the required math.