- ssh handling changed to use method from stackoverflow