moving all client logic to separate thread