refactor : use trenary operator