optimize for if statements with no else