Replace and or hack with ternary operator