Added random tie breaking