added connect_to_server method