Added ternary to reduce multiple lines of code