Change ternary operator to simple if statement