Gets rid of unnecessary copying and makes things more explicit by using a struct with named fields instead of a tuple for tie breaking. Co-authored-by: Jonathan de Jong <jonathan@automatia.nl>