Changed if/else for ternary op