remove anonymous functions, re-org variables for individual sections, set if statements for sections