Fixing logic to continue looking for matching values