fda_colname='DBA Name_update',
                                    sos_colname='Name',
                                    id_var='IMPAQ_ID')
        # turns out address fails to predict anything
        # # try out all the different address columns for a match by address
        # addr_out = mf.address_match_scoring(fda_row, temp_sos, update=True,
        #     addr_split=False,full_addr='Agent Address',id_var='IMPAQ_ID')
        # addr_dict={}
        # for j in addr_cols:
        #     addr_dict[j] = mf.address_match_scoring(fda_row, temp_sos, update=True,
        #         addr_split=False,full_addr=j,id_var='IMPAQ_ID')
        #take max values
        # for j in addr_cols:
        #     addr_out = pd.concat([addr_out, addr_dict[j]]).max(level=0)
        # out = out.merge(addr_out, left_index=True, right_index=True, on='IMPAQ_ID')
        name_match = mf.match_selection(out, 'basic name', name_lvl=.99)
        # addr_match = mf.match_selection(out, 'basic addr',addrnum_lvl=.01,
        #     strname_lvl=.01, strtype_lvl=.01, zip_lvl=.01)

        # if addr_match.empty == False:
        #     match = temp_sos.loc[addr_match.index,:]
        if name_match.empty == False:
            match = temp_sos.loc[name_match.index, :]
            # if more than one tied, take the active record
            if any(match['Status'].apply(
                    lambda x: x in ['Active', 'Good Standing'])):
                match = match.loc[(match['Status'] == 'Active') |
                                  (match['Status'] == 'Good Standing'), :]
                name_match = name_match.loc[match.index, :]
            match = match.loc[name_match.name_score.idxmax(), :]
            # handling for corporation record
 # filter SoS data to the same zip or town as the fda row to improve runtime
 fda_row = fda_df.iloc[i, :]
 temp_sos = sos_df.loc[(sos_df['pzip'] == fda_row['Zip_update']) |
                       (sos_df['pcity'] == fda_row['City_update']), :]
 temp_sos.reset_index(inplace=True, drop=True)
 # run through each matching algorithm
 out = mf.name_match_scoring(fda_row,
                             temp_sos,
                             fda_colname='DBA Name_update',
                             sos_colname='bizname')
 out = out.merge(mf.address_match_scoring(fda_row, temp_sos, update=True),
                 left_index=True,
                 right_index=True,
                 on='id')
 out = temp_sos.merge(out, left_index=True, right_index=True, on='id')
 match = mf.match_selection(out, 'basic addr')
 match2 = mf.match_selection(out, 'basic name', name_lvl=.99)
 matches.append([fda_row, match])
 matches2.append([fda_row, match2])
 if match.empty == False:
     if isinstance(match, pd.DataFrame):
         match = match.iloc[0, :]
     fda_df.loc[i, 'SoS_record'] = match.id
     fda_df.loc[i, 'entity'] = match.bizname
     fda_df.loc[i, 'agent_name'] = match['Registered Agent Name']
     fda_df.loc[i, 'agent_address'] = match['Registered Agent Address 1']
     fda_df.loc[i, 'agent_city'] = match['Registered Agent City']
     fda_df.loc[i, 'agent_state'] = match['Registered Agent State']
     fda_df.loc[i, 'agent_zip'] = match['Registered Agent Zip']
 elif match2.empty == False:
     if isinstance(match2, pd.DataFrame):