move to socket, cleanup