I think it would be useful to write some documentation on the tie-breaking rule used in the algorithm.