Added credits to a site that helped troubleshoot the global variables issue.