Changed if statements to if else