Used ternary operator to reduce LOC