working version of lookup_names and lookup_all