Add comments for some hard-to-comprehend part.