New function to get location code and name