refined "if" expression in code