refactor : ternary operator