Modified for sockets
modified for sockets