Added switch_url function