Saving some lines with ternary operator