modified dw_find_embedding