Use ternary if for sort order