swapped ternary with if else