Refactored with a ternary operator