Updated for deprecated HashMap::insert_or_update_with function