changed series of if statements to if else
changed series of if statements to if else