Refactored the countries map code