```\nfunction set(Map storage map, address key, uint256 val) internal {\n    if (map.inserted[key]) {\n        map.values[key] = val;\n    } else {\n        map.inserted[key] = true;\n        map.values[key] = val;\n        map.indexOf[key] = map.keys.length;\n        map.keys.push(key);\n    }\n}\n```\n