Added test for updating potential matches and refactoring