move server-communication into separate thread