Improve solution to get city