Changes an if-else to use ternary operator