Reorganized the file: Global function declerations first, then the beginning of the actual script part