why the nested if?