Refactored to use ternary for brevity, efficiency and ease of reading