Add detect city function