Initial upload
Latest updates
major changes to the scripts

tried passing sections to independent functions, but this failed due to
if statements.
Code improvements, stage 1 complete