better identity domain determination