Changes to if statements to prevent repeated errors