Replace ternary with simple if