```\nfunction refund(\n uint256 policyIndex\_,\n uint256 week\_,\n address who\_\n) external noReenter {\n Coverage storage coverage = coverageMap[policyIndex\_][week\_][who\_];\n\n require(!coverage.refunded, "Already refunded");\n\n uint256 allCovered = coveredMap[policyIndex\_][week\_];\n uint256 amountToRefund = refundMap[policyIndex\_][week\_].mul(\n coverage.amount).div(allCovered);\n coverage.amount = coverage.amount.mul(\n coverage.premium.sub(amountToRefund)).div(coverage.premium);\n coverage.refunded = true;\n\n IERC20(baseToken).safeTransfer(who\_, amountToRefund);\n\n if (eventAggregator != address(0)) {\n IEventAggregator(eventAggregator).refund(\n policyIndex\_,\n week\_,\n who\_,\n amountToRefund\n );\n }\n}\n```\n