This still reads poorly... maybe separate it into three comments, each preceding the relevant code block?