replaced logic 'or' with else if