Instead of simply returning when a match is found, determine some way of saving the current configuration as a match and continue looking for potential matches.