Add some more comments, and extract the left diagonal and right diagonal computation from the loop.