updating for v6.1 and making the giant block of if statements into a for loop