improved asynch network code (client side)