Big Fat Refactor Part 1

realised that I had so much code reduplication from having scripts on
separate pages, thus far I've copy-pasted onto the main script page,
delinked the other script pages, but now need to go through and delete
some serious redundant code