Improve country function