refactored many things. almost functional, for some reason the telnet_line_out function is not able to scope the socket variable correctly