Smarter way to do a ternary style operator