ternary operator in .add() instead of if-else