Changed algorithm to treat unmatched implicitly

i.e. no unmatched objects exist, but the computer keeps track of the
number of unmatched to figure out the cost of unmatched and when to stop