wouldn't map.values() also work here instead of iterating?