Considering my original instinct was the code you posted, I've updated it to remove the ternary to simplify.