Improved flow of the script to all be run through main funciton instead of all functions being called by other functions.