Started the total rewrite of the script