make if else with a nested if into an if else if