Little refactoring

If condition replaced by ternary operator