add some comments for explanation of calculations