added server changing logic to clien side