Ternary operator added instead of ifs