looked nicer than 3 if statements in a row that had the same effect