Split the calculations and procedure out into their own modules/classes and into separate files. Program seems to work, too!