initial draft of porting candidate-matches.pl