error checking

added else if statements to make sure all conditions have a result