notes update
comments update
benignly rearrange some code
refactor for legibility