added ternary operator for random is favorite