Rearranged some variables that were unnecessary at certain points