fixed ben's threading/socket code