made the socket api better