Reformatted the if statement to use a ternary operator instead