cleanup unused variables. set socket.
cleanup type definition references