Restructured the socket