What is the version of the following sentence with correct punctuation?

Whether resident or not in your host country if you receive a publicsector pension if you worked as a civil servant you will normally have to pay tax on the pension only to the country that pays the pension
Whether resident or not in your host country, if you receive a public-sector pension (if you worked as a civil servant), you will normally have to pay tax on the pension only to the country that pays the pension.