Second version of the competitions algorithem