I have commented through line 86 and so far I think I understand what each section is supposed to be doing.