Moved function into their own files to make the script more readable.