Slowly working in socat to the script, cleaning up and changing some other stuff.