added more socket code