implemented the socket thing myself