insert into map efficiently. combines the search needed by find and insert