refactor single line 'if'