changed ELSE to ELSE IF

and swapped the statements