Use ternary operator instead of if structure