Remerged socket code