diff --git a/SSH-VPN-VNC/connect2jet b/SSH-VPN-VNC/connect2jet
index b599496ee0c0596fa39694cbd42beff499089139..7a91d226ab143ac93ca04bc275933891974cd3c1 100755
--- a/SSH-VPN-VNC/connect2jet
+++ b/SSH-VPN-VNC/connect2jet
@@ -11,21 +11,24 @@ help() {
 	cat <<EOF
 $0 -g [gateway] -p [port] -r [remote-port] user@remote
 Options:
+  -h				Help
   -g [gateway]      gateway server, e.g. user@login.univie.ac.at
   -p [port]         port to forward from jet to local, e.g. VNC port
   -r [port]         remote port if not the same as port
-  
+  -d				debug
+
 Example:
    $0 -g [U:Account-Username]@login.univie.ac.at [Jet-Username]@jet01.img.univie.ac.at
 
 EOF
 }
-
-while getopts "g:p:r:h" flag; do
+debug=''
+while getopts "g:p:r:hd" flag; do
 	case "${flag}" in
 	g) gateway=${OPTARG} ;;
 	p) port=${OPTARG} ;;
 	r) rport=${OPTARG} ;;
+	d) debug='-v';;
 	h | *)
 		help
 		exit 0
@@ -80,20 +83,21 @@ if [ -n "${gateway}" ]; then
 	fi
 	if [ -n "${port}" ]; then
 		echo "Using gateway: $gateway to $remote "
-		echo "Port Forwarding via the gateway: "
-		ssh -L ${port}:localhost:${port} -t $gateway ssh -L ${port}:${gateway}:${rport} ${remote}
-		echo "$(date) | ssh -L $port:localhost:12345 -t $gateway 'ssh -L 12345:${gateway}:${rport} ${remote}'" >>.${script/.sh/.log}
+		midport=$(($RANDOM % 1000 + 20000))  # 20000 - 21000
+		echo "Port Forwarding via the gateway: $port : $midport : $rport"
+		ssh $debug -L ${port}:localhost:${midport} -t $gateway ssh -L ${midport}:localhost:${rport} ${remote}
+		echo "$(date) | ssh -L ${port}:localhost:${midport} -t $gateway 'ssh -L ${midport}:localhost:${rport} ${remote}'" >>.${script}.log
 	else
 		echo "Using gateway: $gateway to $remote "
-		ssh $command -t $gateway ssh ${command} ${remote}
-		echo "$(date) | ssh $command -t $gateway 'ssh ${command} ${remote}'" >>.${script/.sh/.log}
+		ssh $debug $command -t $gateway ssh ${command} ${remote}
+		echo "$(date) | ssh $command -t $gateway 'ssh ${command} ${remote}'" >>.${script}.log
 	fi
 else
 	if [ ! $remote_status ]; then
 		echo "Could fail if not: [user]@[server]"
 	fi
 	echo "Direct connection to: ${remote}"
-	ssh ${command} ${remote}
-	echo "$(date) | ssh ${command} ${remote}" >>.${script/.sh/.log}
+	ssh $debug ${command} ${remote}
+	echo "$(date) | ssh ${command} ${remote}" >>.${script}.log
 fi
-echo "Command Log in  .${script/.sh/.log}"
+echo "Command Log in  .${script}.log"