Reorganized the code so that the variables from the inputs actually work.