Added else if to the code.